liuyi9509 / codecademy-build-websites-from-scratch-

0 stars 0 forks source link

Duplicate CSS #3

Closed liuyi9509 closed 6 years ago

liuyi9509 commented 6 years ago

From @martoio on July 24, 2018 12:50

See how this code repeats 3 times for each h2?

https://github.com/liuyi9509/Codecademy-SQL-intensive/blob/3fd7c7abc0d022b1c41e79cf61432a920a3f64b8/style.css#L12-L15

What happens if the client decides to change the font-size and the color for the h2s? All of a sudden you have to make 6 edits in your code, when in reality you are only changing 2 things. A better approach would be:

h2{
 font-size:32px;
 font-weight:bold;
 color: white;
}
#brushes {
 background-color: mediumspringgreen;
}

#frames {
 background-color: lightcoral;
}

#paint {
 background-color: skyblue;
}

Copied from original issue: liuyi9509/Codecademy-SQL-intensive#8