HTML - P element

> (World Wide) Web - (W3|WWW) > HyperText markup Language (HTML)

1 - About

The p element is one way of representing a paragraph.

The P tag can only contain inline elements (ie phrasing content). It cannot contain block-level elements (including P itself).

Advertising

3 - Example

The p element can be used to wrap individual paragraphs when there would otherwise not be any content other than phrasing content to separate the paragraphs from each other.

In the following example, the link spans:

  • half of the first paragraph,
  • all of the heading separating the two paragraphs,
  • and half of the second paragraph.

It straddles the paragraphs and the heading.

<header>
 Welcome!
 <a href="about.html">
  This is home of...
  <h1>The Falcons!</h1>
  The Lockheed Martin multirole jet fighter aircraft!
 </a>
 This page discusses the F-16 Fighting Falcon's innermost secrets.
</header>
Here is another way of marking this up, this time showing the paragraphs explicitly, and splitting the one link element into three:

<header>
 <p>Welcome! <a href="about.html">This is home of...</a></p>
 <h1><a href="about.html">The Falcons!</a></h1>
 <p><a href="about.html">The Lockheed Martin multirole jet
 fighter aircraft!</a> This page discusses the F-16 Fighting
 Falcon's innermost secrets.</p>
</header>

4 - Documentation / Reference

web/html/p.txt · Last modified: 2019/02/09 11:41 by gerardnico