Begin Web Programming with PHP & MySQL

Advertisements



HTML div, paragraph, horizontal line and line break tags

The <div> element is the generic container or division for the html document. It has no effect on the content or layout until styled using CSS. <div> is used to group the content and it can be easily styled using the class or id attributes.

The <p> tag defines a paragraph of text. An HTML <p> tag means starting a new paragraph. It is a block-level element and it does not contain another block-level element like another <p> or <div>. By default, most browsers place a line break and a blank line between paragraphs.

The <hr> tag is displayed as a horizontal rule or line on the browser. It is an empty tag, meaning no end tag. The <hr> tag accepts attributes such as width, color, size, and align.

The <br> tag produces a line break in text. It is also an empty tag.

Eg:
<div style="width:400px;height:150px;background-color:green;text-align:center;">
<p style="font-size:15px;color:white;">
A: Hello, How are you?
</p>
<hr>
<p style="font-size:15px;color:white;">
B: I am fine! <br>
Nice to meet you.
</p>
</div>
Output:

A: Hello, How are you?


B: I am fine!
Nice to meet you.