This webpage is updated by Len Hom on May 1, 1999
Len's Stylesheet 1 - Inline Style Markup
Inline Style Markup Example
Let's begin with setting the color of the text for H1 elements.
You can do this by using the STYLE element to set style properties for the
H1 tag as follows:
< H1 STYLE= "color: red " >
- The items between < H1 STYLE= "color: red " > is written in special
notation for style rules.
- Each rule starts with a tag name followed by a
list of style properties enclosed in brackets as noted < and >.
- In this example, the rule matches the H1 tag.
- Each style property starts with the property name, then a colon, and lastly
the value of the property.
- When there is more than one style property in the list,
you need a semicolon between each of them.
- In this example, there are one properties ( color ).
The " color" sets the color of the text.
- It's a good idea to add a semicolon after the value of each property to ensure
that they are properly addressed.
Colors can be given as names or as numerical values, i.e.
rgb ( 204,204,255 )
which is a purple color.
- The three numbers correspond to red, green, and blue,
respectively, in the range of 0 to 255.
- You can use hexadecimal notation also, so that the same color can
be written as #CCCCFF.
Note that the inline STYLE element is placed in the document's HTML BODY section.
Controlling the Font
- Not all fonts are available on all browsers.
- To specify fonts, you are allowed to list several fonts in
preferential order.
- There is a short list of generic fonts that are available
in most browsers, so you should end your list with one of these:
serif, sans-serif, cursive, fantasy, or monospace, i.e.
BODY { font-family: Times New Roman, cursive, sans-serif; }
H1,H2 { font-family: Times New Roman, cursive, sans-serif; }
- In this example, H1 headings are shown preferably in red Times New Roman font ,
- H2 headings would appear in blue font.
If you have any comments or questions, please send email to:
Len Hom
Back
Next
Return to Beginning of Page
I take full responsibility
for the information posted. The information on this page
represents that of myself and not that of
California State University,
Sacramento or the School of
Engineering and Computer Science