Understanding the Paragraph Element and bringing out the Solution

To start practicing this, first understand what exactly it is: HTML5: Understanding Elements.

Continuation of Understanding Element:

In general, pressing the ENTER key begins a new paragraph. However, in HTML, the browser does not recognize the gap provided by the ENTER key. As a result, at the place where you want to start a new paragraph, you must introduce a special element or tag known as the paragraph element (P element). The paragraph tag is a container tag; therefore, it includes both the opening <P> and closing </P> tags. Understanding the paragraph element and bringing out the solution:

AttributePurpose
classdefines the name of the element
dirdefines the direction of the paragraph written from left to right or from right to left
iddefines the value of the id
langdefines the language in which the paragraph is written
styledefines the inline style of the element
titleprovides extra information about the element
Onclickopens an HTML document on a mouse click
Ondblclickopens an HTML document on a double-click
Onmousedownopens an HTML document on pressing of a mouse button
Onmousemoveopens an HTML document by moving the mouse pointer
Onmouseoutopens an HTML document when the mouse pointer is moved out of the element
Onmouseoveropens an HTML document when the mouse pointer is moved over the element
Onmouseupopens an HTML document when the mouse button is released
Onkeydownopens an HTML document by pressing a key
Onkeypressopens an HTML document by clicking and releasing the mouse
Onkeyupopens an HTML document document when a key is released
Table 9.1 – List of Attributes for the P Element

Working with a Paragraph:

HTML includes an element that can be used to specify the content of an HTML page as a paragraph. To further understand how the paragraph element is used in an HTML document, let’s construct an HTML file called para.html. Below is the code for the para.html file.

In the above code, we’ve included some information without the P element and some with the P element. Figure 9.1 depicts the output from the above code.

Figure 9.1 – Displaying the output of using a Paragraph Element

Figure 9.1 shows that the content displayed in the first section is in a single paragraph because just one P element is utilized. The same text is played twice in the second segment due to the use of two P components.

Scroll to Top