HTML and CSS Reference
In-Depth Information
and portable holes.
In this case, just wrap the excess text in a paragraph or a div as appropriate:
<body>
<h1>Welcome to Acme!</h2>
<p>
Your one-stop source for rockets, explosives, anvils,
and portable holes.
</p>
Another element that often surprises is img . This is an inline element, and it should be wrapped in a div or
possibly a paragraph. For instance, change this:
<img src="cup.gif" width="89" height="67" alt="Cup" />
to this:
<div>
<img src="cup.gif" width="89" height="67" alt="Cup"/>
</div>
figure Element
HTML 5 may add a figure element specifically for block-level images:
<figure>
<img src="cup.gif" alt="Cup"
width="89" height="67"/>
</figure>
It is also a validity error if a p element contains another p or block element. The paragraph is the lowest block-
level element. Although a div , blockquote , or table can contain a paragraph, the reverse is not true. For
example, this is a problem:
<p>Once upon a time someone famous said,
<blockquote cite="Percy Bysshe Shelley, Ozymandias">
<p>My name is Ozymandias, king of kings</p>
<p>Look on my works, ye mighty, and despair!</p>
</blockquote>
but who it was that said that, I cannot say. He has been
forgotten.
</p>
The usual way to fix it is to make two paragraphs—one before the blockquote and one after, like so:
<p>Once upon a time someone famous said,</p>
Search WWH ::




Custom Search