|
 |
Style Attribute
The first way to add a style to you page is to simply declare it inside an HTML tag. The way to do this is to add the style=" " attribute to an html tag. The general form to add one style property looks like this:
style="property: value;"
To help clarify this, let's look at an example. If you want the color of some text to look red, the style attribute would look like this:
style="color: red;"
The style sheet property is "color". The value of the color is "red". Notice there is a colon in between color and red, not an equal sign, and there are no extra quote marks.
Example - Style Attribute
Style Attribute
The style attribute can be applied to the Elements (tags) within the body of the document.
In this example the style attribute is used to control the colour for items such as:
Paragraph Blue
Bold Maroon
Italic Green
Small Red
- List Item Blue
- List Item Green
- List Item Teal
Remember to use the American spelling of color!
|
The HTML
<html>
<head>
<title>Style Attribute</title>
</head>
<body style="color:Navy;">
<h2 style="color:CornflowerBlue;">Style Attribute</h2>
The style attribute can be applied to the Elements (tags)
within the body of the document.
In this example the style attribute is used to control the colour for items such as:
<p style="color:Blue;">Paragraph Blue
<p><b style="color:Maroon;">Bold Maroon</b>
<p><i style="color:Green;">Italic Green</i>
<p><small style="color:Red;">Small Red</small>
<ul>
<li style="color:Blue;">List Item Blue
<li style="color:Green;">List Item Green
<li style="color:Teal;">List Item Teal
</ul>
<p><i><b style="color:Red;">Remember to use the
American spelling of color!</b></i>
</body>
</html>
|
Back to Top of Page
© 2002 Ashley Preston
|
 |