-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored the tasks as per good advice from ben
- Loading branch information
1 parent
ad5b9f8
commit 1180b8f
Showing
2 changed files
with
139 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
PLAN: | ||
https://css-tricks.com/difference-between-types-of-css-variables/ | ||
Lvl 1: | ||
- Existing CSS; convert multiple places where a property is used to variables (do several, including colors, sizes, etc.) | ||
- Add new CSS variables and apply them | ||
Lvl 2: | ||
- Reset a variable within a media query (example: https://codepen.io/chriscoyier/pen/ORdLvq?editors=0110) | ||
- Dark mode/light mode toggle switch for the website!! (tie css variables to function called on button click) | ||
Lvl 3: | ||
- Slider to make text size larger/smaller? | ||
- Something using calc() or another css fn? | ||
*/ | ||
|
||
/* Your tasks: | ||
1. Convert the following values to CSS variables, and replace the value itself in the CSS with the variable name. Make your CSS variable names semantic so they make sense with what you're using them for! | ||
Keep them as their original value for now - just transfer that value to a CSS variable. For example, the background color of the whole page is set to antiquewhite, so when you replace that with a variable, make sure the variable has antiquewhite as a value. The appearance of the page shouldn't change at this point! | ||
You should make variables for: | ||
- body background color | ||
- ".plant-listing" background color | ||
- body text color | ||
- ".plant-header" font size | ||
- ".plant-description" font size | ||
2. Create a new class called ".dark-mode-theme". Only within this class, reassign some of the CSS variables you made earlier like so: | ||
- Make the body background color variable's value black. | ||
- Make the ".plant-listing" background color to rgb(0, 87, 0) | ||
- Make the body text color white. | ||
3. In your JavaScript file, create a function that uses the button with id "dark-mode-button" to toggle this class on and off of the body of your webpage. Now you have a fancy dark mode button, thanks to the power of CSS variables! | ||
*/ | ||
|
||
body { | ||
background-color: antiquewhite; | ||
color: black; | ||
} | ||
|
||
header { | ||
text-align: center; | ||
} | ||
|
||
main { | ||
display: flex; | ||
justify-content: center; | ||
} | ||
|
||
.plant-listing { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-around; | ||
align-items: center; | ||
padding: 35px 25px; | ||
margin: 25px; | ||
border-radius: 10px; | ||
width: 25vw; | ||
height: 40vh; | ||
text-align: center; | ||
background-color: rgb(197, 231, 147); | ||
} | ||
|
||
.plant-header { | ||
font-size: 24px; | ||
} | ||
|
||
.plant-pic { | ||
height: 300px; | ||
width: auto; | ||
} | ||
|
||
.plant-description { | ||
font-size: 16px; | ||
} | ||
|
||
.plant-listing > button { | ||
padding: 10px; | ||
border-radius: 10px; | ||
} | ||
|
||
footer { | ||
text-align: center; | ||
padding: 5vh; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters