Using CSS 3 Ways
There are basically three ways to use CSS on an HTML page.
When to use
Depending on what you are trying to achieve, you'll use one of these three CSS methods; inline CSS, internal stylesheets, or external stylesheets.
Most often you will use an External CSS Stylesheet. You do that by generating this HTML tag in your <head> and </head> section:
<link rel="stylesheet" type="text/css" href="style.css">
From time to time you may use an internet stylesheet. Those look like this:
Anything between the <style> and </style> tags is CSS.
Finally, you can tweak an individual HTML element by using inline CSS, which looks like this:
<p style="color: blue;">
Where anything between the quotation marks is your css.
Order of precedence goes:
- inline css
- internal stylesheet
- external stylesheet.
Meaning, inline css over-rides internal sheets, which over-ride external sheets.
Hints & tips
- There are 3 main ways to use CSS
- Inline CSS
- Internal Stylesheets
- External Stylesheets
Lesson notes are only available for subscribers.