top of page

10.05.2018: One Lesson of Coding


Today's soundtrack is Sinsaenum: Repulsion for Humanity, a death metal album that reminds me of a cross between "Domination" era Morbid Angel and "Conceived in Fire" era Living Sacrifice. Great stuff.


This evening, I'm learning on freeCodeCamp how to prioritize one CSS style over another if they conflict - for example, if my HTML style contradicts my paragraph style.


I first tried applying a text colour style to a section of my HTML page that had already been modified by the HTML style; the specific style element won. I then tried making a second style and applied it, too, to the HTML element, along with the first. I found that whichever style is closest to the end of the style section will "win." So if my HTML style makes all text green, but I apply a green text style to a paragraph, it will turn green; however, if I create an additional blue text style and apply that, it will take precedence - unless I change the order within the style section itself. The order in the class callout won't make a difference. In summary, HTML pages read CSS styles from top to bottom.


That's all for tonight! In the next section, I'll be learning about overriding the default "bottom-to-top" priority sequence by using ID attributes.

bottom of page