HTML - tags - p tag

revision:


Content

"p" tag : paragraph tag syntax some examples


"p" tag : paragraph tag

top

The <p> tag defines a paragraph. Paragraphs are usually represented in visual media as blocks of text separated from adjacent blocks by blank lines and/or first-line indentation, but HTML paragraphs can be any structural grouping of related content, such as images or form fields. Browsers automatically add a single blank line before and after each <p> element.

Paragraphs are "block-level" elements, and notably will automatically close if another block-level element is parsed before the closing </p> tag. Use CSS to style paragraphs.

Attributes: the <p> element supports the global attributes and events attributes.


syntax

top

<p> . . . </p>


some examples

This is a paragraph.

This is a paragraph.

This is a paragraph.

Codes:

                    <p class="spec">This is a paragraph.</p>
                    <p class="spec">This is a paragraph.</p>
                    <p class="spec">This is a paragraph.</p>
                

This paragraph contains a lot of lines in the source code, but the browser ignores it.

This paragraph contains a lot of spaces in the source code, but the browser ignores it.

The number of lines in a paragraph depends on the size of your browser window. If you resize the browser window, the number of lines in this paragraph will change.

Codes:

                    <p class="spec">
                        This paragraph
                        contains a lot of lines
                        in the source code,
                        but the browser 
                        ignores it.
                    </p>
                        
                    <p class="spec">
                        This paragraph
                        contains      a lot of spaces
                        in the source     code,
                        but the    browser 
                        ignores it.
                    </p>
                        
                    <p class="spec">
                        The number of lines in a paragraph depends on the size of your browser window.
                        If you resize the browser window, the number of lines in this paragraph will 
                        change.
                    </p>