HTML is about content and structure. It was not intended to define style.
Instead, we use CSS (Cascading Style Sheets) to make our web page look nice.
Styles can be specified at four levels:
Styles lower on the list override styles at the top of the list. For example, if you specify
a color with a tag selector, it will be overridden by the color within a class
- tag selector - applies to elements matching the given tag and it's children
- class selector - applies to elements with a matching class attribute
- id selector - applies to the single element with the matching id attribute
- an individual element's style attribute
Here are some good resources for learning CSS properties:
This is a paragraph of plain text. It renders with whatever default color, font and size that
the browser chooses.
This is a paragraph with a specific style. The text is displayed in a red, 16pt,
This paragraph does not have a style attribute. Instead, it has a class
attribute. That class links to the matching selector above.
This is an example of how you can center a block but not center the text within that block.
- First things first
- Then do the second thing
- And finally, the last thing