Paragraph

Knowledge | HTML Tutorial


Definition and Usage

The <p> tag defines a paragraph.

Browsers automatically add some space (margin) before and after each <p> element. The margins can be modified with CSS (with the margin properties).

Optional Attributes
DTD indicates in which HTML 4.01/XHTML 1.0 DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.

align 	left              Deprecated. Use styles instead.
        right             Specifies the alignment of the text within a paragraph
        center
        justify 	
                        

Standard Attributes
The <p> tag supports the following standard attributes:

Attribute 	Value 	         Description 	                                                DTD
class 	        classname 	 Specifies a classname for an element 	                        STF
dir 	        rtl              Specifies the text direction for the content in an             STF
                ltr 	         element 	
id 	        id 	         Specifies a unique id for an element 	                        STF
lang 	        language_code 	 Specifies a language code for the content in an element 	STF
style 	        style_definition Specifies an inline style for an element 	                STF
title 	        text 	         Specifies extra information about an element 	                STF
xml:lang 	language_code 	 Specifies a language code for the content in an element,   	                 documents in XHTML                                             STF

Examples:
Code




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.

Result:

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. 

Using align Attribute:

If you have invested your time and money to design a website you need dependable web hosting services to remain profitable. You need it to be up, 24/7, unlike your company’s physical front door customers will come to your website at any hour, day or night and you’ve got to be ready for them. We help businesses to manage the infrastructure, security, support and maintenance of a mission critical website. Additionally, all our hosting packages are built-in with cross devices and platforms compatible technologies, what this means is that your professional site will be properly display on any device regardless whether is a desktop, a mac, a tablet, an iPad, a smart phone, and an iPhone, it will always be displayed with the same professionally look and feel no matter what you or your potentials will use.

Result:

If you have invested your time and money to design a website you need dependable web hosting services to remain profitable. You need it to be up, 24/7, unlike your company’s physical front door customers will come to your website at any hour, day or night and you’ve got to be ready for them. We help businesses to manage the infrastructure, security, support and maintenance of a mission critical website. Additionally, all our hosting packages are built-in with cross devices and platforms compatible technologies, what this means is that your professional site will be properly display on any device regardless whether is a desktop, a mac, a tablet, an iPad, a smart phone, and an iPhone, it will always be displayed with the same professionally look and feel no matter what you or your potentials will use.

Other ways to work with paragraph

The HTML Tag Should NOT be Used
The tag is deprecated in HTML 4, and removed from HTML5.
The World Wide Web Consortium (W3C) has removed the tag from its recommendations.
In HTML 4, style sheets (CSS) should be used to define the layout and display properties for many HTML elements.
The example below shows how the HTML could look by using the tag:




Look! Styles and colors

This text is in Verdana and red

This text is in Times and green

This text is 30 pixels high

Result:



This is a heading

This is a paragraph.

Result:




This paragraph is in Arial, size 5, and in red text color.

This paragraph is in Verdana, size 3, and in blue text color.

The font element is deprecated in HTML 4. Use CSS instead!

Result:

Related Articles