Resources | Subject Notes | Information Communication Technology ICT
Cascading Style Sheets (CSS) are used to control the presentation of HTML elements. Saving styles as a CSS file allows for consistent styling across multiple web pages and improves website organization.
To create a CSS file:
styles.css
).CSS rules consist of a selector and a declaration block. A declaration block contains one or more declarations, each with a property and a value.
Example:
h1 {
color: blue;
font-size: 24px;
}
Once the CSS rules are written, save the CSS file.
To apply the saved styles to an HTML document, use the element in the
section.
Example:
Website Authoring
This is a Heading
This is a paragraph of text.
Here are some examples of CSS styles you can save in a CSS file:
Property | Value |
---|---|
color |
red |
font-size |
16px |
font-family |
Arial |
background-color |
#f0f0f0 |
Saving styles in a CSS file is a fundamental aspect of website authoring. It promotes organization, consistency, and maintainability of web designs.