Last active
November 12, 2022 02:09
-
-
Save abdallahmalima/bc95769d9b4d27ab8b295a582b073357 to your computer and use it in GitHub Desktop.
Check DRY principle
This file contains hidden or 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
/*=======================================*\ | |
this code does Not follow DRY principle | |
\*=======================================*/ | |
.cat { | |
font-family: "Times New Roman", Times, serif; | |
font-size: 1rem; | |
color: #FFF; | |
} | |
.dog { | |
font-family: "Times New Roman", Times, serif; | |
font-size: 1rem; | |
color: #000; | |
} | |
.dragon { | |
font-family: "Times New Roman", Times, serif; | |
font-size: 1rem; | |
color: #009933; | |
} | |
/*=======================================*\ | |
this code does follow DRY principle | |
\*=======================================*/ | |
:root { | |
--primary-font-family: "Times New Roman", Times, serif; | |
--primary-font-size:1rem; | |
} | |
.cat { | |
font-family: var(--primary-font-family); | |
font-size: var(--primary-font-size); | |
color: #FFF; | |
} | |
.dog { | |
font-family: var(--primary-font-family); | |
font-size: var(--primary-font-size); | |
color: #000; | |
} | |
.dragon { | |
font-family: var(--primary-font-family); | |
font-size: var(--primary-font-size); | |
color: #009933; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment