Before we start with JavaScript, let's first finish styling the site by centering the content in the middle of the page like this:
Hint
- Is the box the right size? Does it need to be bigger or smaller?
- Using
grid
, explore thejustify-content
andalign-items
The goal of this exercise is to change the background colour of the app and the corresponding descriptive text depending on the temperature. These are the following conditions:
-
If the temperature is 20 degrees or higher:
- The colour of the background should be
#fab1a0
- The text should read
Yikes! It's too hot 🔥.
- The colour of the background should be
-
If the temperature is 0 - 19 degrees:
- The colour of the background should be
#55efc4
- The text should read
It's just right 👍.
- The colour of the background should be
-
If the temperature is -1 degrees or below:
- The colour of the background should be
#74b9ff
- The text should read
Brr! It's too cold ❄️.
- The colour of the background should be
Hint
- Think about how we get elements from the
Document Object Model (DOM)
- To update any CSS property on an element, you can manipulate it through the
style
property on that DOM object- (e.g.
someElement.style.maxWidth = '50%';
)
- (e.g.
- To update the text of an element, you can manipulate it through the
innerText
property- (e.g.
someElement.innerText = "hello"
)
- (e.g.