Category: 

What Is an HTML Paragraph?

Article Details
  • Written By: Eugene P.
  • Edited By: Angela B.
  • Last Modified Date: 26 October 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
NASA scientists have discovered a class of stars with atmospheric temperatures cooler than the human body.  more...

December 2 ,  1982 :  The first permanent artificial heart was implanted in a human.  more...

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.

Ad

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.

Ad

You might also Like

Recommended

Discuss this Article

Vincenzo
Post 2

@Logicfest -- I don't know. I would think that all browsers, at this point, would interpret CSS the same way. Standards are a big deal, after all, and those browsers that refused to follow them aren't around anymore.

You can get some more flexibility with formatting through CSS, so why not use it? All modern browsers should interpret things the same way.

Logicfest
Post 1

One of the great things about the good old paragraph tag is that it is a standard thing that will be interpreted by virtually all browsers in exactly the same way. In other words, it is a reliable way to achieve formatting regardless of what browser is interpreting the page.

There are some arguable better options in CSS, but will they all be interpreted the same way? Maybe and maybe not. There are times it is best to go with what you know will work.

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email