Linking HTML and CSS
- 2 ways of styling HTML:
- Using a style tag.
- Linking a CSS external link within the head tag.
- By linking HTML to an external CSS file, we can easily style contents without making the HTML codebase complicated.'
// Method #1 - within HTML
<style></style>
// Method #2 - outside HTML
<link href="style.css" rel="stylesheet" />
Writing CSS Code
- CSS points to a specific HTML element to change its style.
- Use selectors on CSS to style elements in HTML.
- There are countless properties of CSS we can use (NO NEED NOT MEMORIZE!).
- A CSS property always has a property and a value.
- Each property has its own form of value.
h1 {
color: blue;
font-style: italic;
font-weight: 800;
font-size: 20px;
}
What Does Cascading Mean?
- Cascading mean "one after the other".
- In general, CSS is read from top to bottom by the browser.
- The code on the bottom will always prevail and is what will be displayed on the website.