Description
The <p>
tag defines a paragraph. The <p>
element is the most commonly used block-level element. However, it cannot contain block-level elements (including <p>
itself).
The following table summarizes the usages context and the version history of this tag.
Placement: | Block |
---|---|
Content: | Inline and text |
Start/ End Tag: | Start tag: required, End tag: optional |
Version: | HTML 2, 3.2, 4, 4.01, 5 |
- As a logical element, empty paragraphs are ignored by the browsers, so do not use empty <p> elements to add blank lines in your web pages. To create blank lines use the <br> tag, or use the CSS margin property instead.
- When you use the <p> element to begin a paragraph, it automatically creates some space (margin) above and below the content. This space is applied by the browser's built-in style sheets, but you can override it using CSS margin property.
Syntax
The basic syntax of the <p>
tag is given with:
HTML/XHTML: <p> ... </p>
The example below shows the <div>
tag in action.
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
Note: In HTML, the end tag for the <p> element may be omitted. In XHTML, the <p> tag must be properly closed i.e. both start tag and end tag are required.
Tag-Specific Attributes
The following table shows the attributes that are specific to the <p> tag.
Global Attributes
Like all other HTML tags, the <p>
tag supports the global attributes in HTML5.
Event Attributes
The <p>
tag also supports the event attributes in HTML5.
Browser Compatibility
Element | |||||
---|---|---|---|---|---|
<p> | Yes | Yes | Yes | Yes | Yes |
- Installation
- HTML <a> Tag
- HTML <abbr> Tag
- HTML <acronym> Tag
- HTML <address> Tag
- HTML <applet> Tag
- HTML <area> Tag
- HTML <article> Tag
- HTML <aside> Tag
- HTML <audio> Tag
- HTML <base> Tag
- HTML <b> Tag
- HTML <basefont> Tag
- HTML <bdi> Tag
- HTML <bdo> Tag
- HTML <big> Tag
- HTML <blockquote> Tag
- HTML <br> Tag
- HTML <body> Tag
- HTML <center> Tag
- HTML <button> Tag
- HTML <cite> Tag
- HTML <canvas> Tag
- HTML <caption> Tag
- HTML <code> Tag
- HTML <col> Tag
- HTML <dd> Tag
- HTML <colgroup> Tag
- HTML <dfn> Tag
- HTML <del> Tag
- HTML <div> Tag
- HTML <dl> Tag
- HTML <details> Tag
- HTML <dt> Tag
- HTML <em> Tag
- HTML <embed> Tag
- HTML <fieldset> Tag
- HTML <figure> Tag
- HTML <figcaption> Tag
- HTML <font> Tag
- HTML <footer> Tag
- HTML <datalist> Tag
- HTML <frameset> Tag
- HTML <frame> Tag
- HTML5 Global Attributes
- HTML <head> Tag
- HTML <header> Tag
- HTML <hgroup> Tag
- HTML <hr> Tag
- HTML <html> Tag
- HTML <iframe> Tag
- HTML <i> Tag
- HTML <form> Tag
- HTML <input> Tag
- HTML <keygen> Tag
- HTML <legend> Tag
- HTML <ins> Tag
- HTML <kbd> Tag
- HTML <li> Tag
- HTML <link> Tag
- HTML <map> Tag
- HTML <img> Tag
- HTML <mark> Tag
- HTML <menu> Tag
- HTML <meta> Tag
- HTML <meter> Tag
- HTML <nav> Tag
- HTML <noframes> Tag
- HTML <noscript> Tag
- HTML <object> Tag
- HTML <ol> Tag
- HTML <optgroup> Tag
- HTML <option> Tag
- HTML <output> Tag
- HTML <p> Tag
- HTML <param> Tag
- HTML <pre> Tag
- HTML <progress> Tag
- HTML <q> Tag
- HTML <rp> Tag
- HTML <rt> Tag
- HTML <ruby> Tag
- HTML <s> Tag
- HTML <samp> Tag
- HTML <script> Tag
- HTML <section> Tag
- HTML <select> Tag
- HTML <small> Tag
- HTML <source> Tag
- HTML <strike> Tag
- HTML <span> Tag
- HTML <style> Tag
- HTML <strong> Tag
- HTML <sub> Tag
- HTML <summary> Tag
- HTML <sup> Tag
- HTML <table> Tag
- HTML <tbody> Tag
- HTML <td> Tag
- HTML <textarea> Tag
- HTML <th> Tag
- HTML <tfoot> Tag
- HTML <thead> Tag
- HTML <source> Tag
- HTML <tr> Tag
- HTML <tt> Tag
- HTML <title> Tag
- HTML <u> Tag
- HTML <ul> Tag
- HTML <var> Tag
- HTML <video> Tag
- HTML <wbr> Tag
- HTML <dir> Tag