Thursday, 5 February 2015

INCLUDING SYTLES IN TAGS.

 You’ve already seen how HTML pages are created using tags. I want to stop briefly and discuss attributes as well. An attribute is an additional bit of information that somehow affects the behavior of a tag. Attributes are included inside the opening tag in a pair. Here’s an example.
<tag attribute=”value”>
Some attributes can be used with nearly any tag; others are highly specific. One attribute that can be used with nearly any tag is style. By including the style attribute in a tag, you can include one or more style rules within a tag itself. Here’s an example using the
<h1 style=”font-family: verdana, sans- serif;”> heading :/h1>
The style attribute of the <h1>  tag contains a style declaration. All style declarations follow this same basic pattern, with the property on the left and the value associated with that property on the right. The rule ends with a semicolon, and you can include more than one in a style attribute by placing commas between them,. If you’re only including one rule in the style attribute, the semicolons optical, but it’s a good idea to include it. In the preceding example, the property is font-family, and the value is verdana, sans-serif. This attribute modifies the standard <h1> tag by changing the font to verdana, and if the user doesn’t have that font installed on his system, whichever sans-serif font the browser selects. (sans-serif fonts are those that do not include serifs, the small lines at the ends of characters).
There are many, many properties that can be used in style declarations. As I’ve already said, putting a declaration into a style attribute is just one of several ways that you can apply styles to your documents.

No comments:

Post a Comment