Style (2)
We can specify graphic styles to the XHTML tags. But sometimes it happens that we want to specify a style only a part of paragraph, or maybe for a few paragraphs, but there is no corresponding tag in the text. In such situation, we can use tags „<div>“ and „<span>“. These tags mean nothing per se – if we add them to the text, nothing changes – but we can attach styles to them. We can use them to specify a style for a part of page without corresponding XHTML tag. The „<div>“ tag can contain a few paragraphs; the „<span>“ tag can contain a few words inside of one paragraph.
Example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Miscellaneous styles</title>
<style type="text/css">
div.text_in_frame {
border: 1px solid red;
}
span.blue_words {
color: blue;
}
</style>
</head>
<body>
<p>The following text is in a frame.</p>
<div class="text_in_frame">
<p>I like
<span class="blue_words">rivers, sea, ocean</span>.</p>
<p>Whenever I see a word related to
<span class="blue_words">water</span>,
I must write it using a blue color.</p>
</div>
<p>This text was a piece of art.</p>
</body>
</html>
The following text is in a frame.
I like rivers, sea, ocean.
Whenever I see a word related to water, I must write it using a blue color.
This text was a piece of art.
0 Comments:
Post a Comment
<< Home