How to Write CSS Style Sheets
Cascading style sheets are an easy way to control your website's layout. Making a change to your CSS page impacts every page on your site without requiring you to go into each page to fix the styling. You can cascade a second CSS page to overrule the site's style for a specific area of the site. You also can use styling directly in your HTML code or CSS at the top of a single HTML page.
Instructions
-
-
1
Open a new file in a plain text editor, such as Notepad on Microsoft Windows.
-
2
Type the selector you want to style. The selector is the name of a tag used in your HTML document such as "p," "a" or "h1." Press the space bar, then type "{" to begin styling your selected tag. For our example, style the "<p>" tag by typing:
p {
-
-
3
Press "Enter" to go to the next line, then enter a property. Properties include color, font-family and font-size. Type "color: blue;" to change the color of the text to blue. "Color" is the property and "blue" is the value. After every value, type a semicolon to indicate that it is the end of your style. Enter another style by typing "font-family: Tahoma;." Include as many properties as necessary for each style.
-
4
Type a "}" at the end of the style. Press "Enter" to go to a new line to begin a new style. The code for the sample paragraph style would be:
p {
color: blue;
font-family: Tahoma;
}
If you want to use the same style for two or more codes, such as the paragraph and h1, type it as follows:
p, h1 {
color: blue;
font-family: Tahoma;
}
-
1