A HyperText Markup Language (HTML) paragraph is a tag used inside an HTML document to define a block as a paragraph. It is a block-level element and is prohibited by the HTML language specification from containing most other block-level elements. Encasing a block of text within an HTML paragraph tag has the effect, in most web browsers, of inserting a blank line before the paragraph begins and after the end of the block. Defining an area as a paragraph also has the benefit of allowing the entire contents to have specific styles applied to it through the use of cascading style sheets (CSS). It is generally considered bad form to use multiple paragraph blocks as the only formatting on a page, although there are some situations in which this might be necessary.
The HTML paragraph tag is one of the most basic elements that can be contained in an HTML document. It also is a block-level element, meaning it defines a block of code or text. This restricts the type of code that an HTML paragraph can actually contain, excluding most other block-level elements such as structured lists and other paragraphs. Only inline formatting tags can be used inside of a paragraph block, including tags for italics, bold or address links.
The reason an HTML paragraph tag is necessary is that, when an HTML document is read by a web browser, it removes most of the spaces and line breaks that were used. There are a number of reasons for this, but one is because of the different ways computer operating systems actually define a line break, making it easier to remove them than to translate them. Without the ability to use line breaks, HTML tags must be utilized to define formatting. Often used in conjunction with the HTML paragraph tag is another tag known as a line break, which simply inserts a blank line wherever the tag is located. Using multiple line breaks inside a larger paragraph block is the preferred way of providing spacing, as opposed to many paragraph tabs that, when placed concurrently together, will actually cause multiple line breaks between paragraphs.
There are several attributes an HTML paragraph tag can use, although some of them have been replaced by CSS attributes that provide more accurate layout and spacing options. Alignment of the paragraph — to the right, left or center — is one of these depreciated attributes. Some other elements of a paragraph that can be changed are the direction of the text for foreign languages and the reaction to normal user actions such as passing the mouse over the block or clicking on it.