HTML and CSS Reference
In-Depth Information
EXPLANATION
3
The <span> tag defines a left margin increased by 10% relative to this paragraph,
and changes the font size to 26 points. The only part of the document to be affect-
ed is the paragraph in which the <span></span> tags are enclosed. The text The
Three Little Bears will be displayed according to this style.
4
The <span> tags have no effect on this paragraph. The style reverts to the rule in
the style sheet. See Figure 14.19.
Figure 14.19 The <span> tag only affects a specific portion of the text.
14.9.2 The <span> Tag and the class Attribute
The <span> tag provides no visual change by itself. It allows you to change or modify the
appearance of a selected portion of a document within the tags based on a CSS class rule.
Example 14.19 highlights specific portions of text between the <span></span> tags.
EXAMPLE 14.19
<html>
<head>
<style type="text/css">
1
span.highlight { background-color:yellow }
</style>
</head>
<body>
 
 
Search WWH ::




Custom Search