The <p>
element is used to define a paragraph in HTML.
Paragraphs are block-level elements and always start on a new line.
Most browsers automatically add white space (also called margins) before and after each paragraph.
<p>This is a paragraph.</p>
<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p>
<p>
tags for separate blocks of text.<div>
, <table>
, etc.
In HTML, you cannot control exactly how content will appear on every screen.
Different devices such as large desktops, small phones, or resized browser windows may display elements differently.
Adding extra spaces or blank lines in your HTML code will not affect the actual output on the browser.
Browsers treat multiple spaces or line breaks as a single space unless styled or formatted otherwise.
The <hr>
tag defines a thematic break in an HTML document.
It is commonly displayed as a horizontal line, and is used to separate sections or indicate a change in topic.
<hr>
The <br>
tag in HTML is used to insert a line break within a block of text.
It allows content to continue on a new line without starting a new paragraph.
<br>
The <pre>
element is used to display preformatted text.
Text inside a <pre>
block retains all spaces and line breaks exactly as written in the HTML source.
It is usually shown in a monospace (fixed-width) font like Courier.
<pre> Line 1 of text Line 2 with spaces Line 3 on a new line </pre>
Line 1 of text Line 2 with spaces Line 3 on a new line
<pre>
preserves formatting: spaces, tabs, and new lines.<code>
for displaying code samples.