HTML and CSS Reference
In-Depth Information
here are two block elements inside the body element in Example 2.5: a
division element, div , with an id attribute, and a paragraph element, p , with a
style attribute. he id attribute provides a unique identiier for the division for
use in the style element in the document head. he style attribute provides a
means of specifying CSS rules directly within the HTML element. Inside the
division element, an inline emphasis element, em , emphasizes the phrase “all
Figure 2.5 shows how this appears in a browser. Note that the division has a
margin of 36 pixels separating it from the rest of the content on all four sides.
he paragraph following the division has default margins. Also, even though
the phrase “all members” in the division and the words “Emphasis, mine.” in
the paragraph both appear in italics, a search engine robot reading this page
will regard the former as having some importance, but not the latter. his is
because the italic styling of the paragraph is done with CSS, which robots gen-
erally ignore, whereas the styling of the words “all members” comes as a result
of the semantic markup applied to the phrase.
Figure 2.5: A web page with a division element to control margins
he emphasis element in the preamble division can be changed from an
inline element to a block element by adding the CSS rule display: block; . We
can do this by adding a style attribute to the starting em tag, as was done with
the paragraph:
<em style="display: block;">
Search WWH ::

Custom Search