728x90
Refactoring
Give colored-section to each section
And remove css with the same stylings.
Selector Priority
inline styles are more specific than internal or external CSS styles.
As you can see, inline style overrides external CSS.
h1 element VS. class VS. Id
Id style overrides all the other styles.
Even though I changed the order of class and id, id style overrides all since it's more specific.
Tips for preventing error-prone selector rule.
- Always consider to use "class" not "id" even if it only appears once.
- Try to keep it specific and apply only a single custom class to each of elements.
- Avoid inline styles at all costs.
728x90
'Web Dev' 카테고리의 다른 글
The Document Object Model (DOM) (0) | 2021.01.03 |
---|---|
Intermediate Javascript (0) | 2021.01.02 |
Intermediate CSS - PART II (Media Query Breakpoints, Refactoring, Selectors) (0) | 2020.12.26 |
CSS position: Relative VS. Absolute (0) | 2020.12.25 |
Intermediate CSS - PART I (0) | 2020.12.25 |
댓글