![]() |
Style sheets can get complex depending on how involved the formatting of your web pages is. Fortunately, the basics are straight-forward. Style sheets consist of rules that are applied to text associated with specified mark-up tags. The following style rule for a level 1 heading contains the most commonly used attributes found in style sheets.
<style>
h1 {
font-family: Arial,Helvetica,sans-serif;
font-size: 20pt;
font-weight: bold;
font-decoration: underline;
color: red;
background-color: transparent;
}
</style>
Like all style sheets that are placed directly in a web page, this one is enclosed by <style> tags, which would be inserted in the head section of the HTML file. The rule begins with the mark-up identifier, in this case h1. The style attributes belonging to the follow enclosed by braces, { and }. The name of each attribute is followed immediately by a colon. The value assigned to the attribute is then listed and followed by a semicolon. The above example contains six attributes, which are described below.
There are many other style attributes controlling such feature as line spacing and margins, but those shown above are sufficient for the majority of formatting done in most web pages.