What are HTML Paragraphs?
In HTML, The tag <p> is used to define a paragraph.
Important Points
- You can put HTML Paragraphs in all types of HTML-Elements.
- HTML Paragraphs provide additional information to HTML-Elements.
- HTML Paragraphs should always be declare in the starting tags.
- More than 100 HTML Paragraphs can be written in a the same starting tag.
- HTML Paragraphs are always written in (name="value") Ex: <p title="Codingwith Anas">Codingwith Anas</p>.
Display Of Paragraphs
HTML paragraphs creates a block of text that starts on a new line by ignoring extra spaces and new lines.
<p>Paragraph 1</p> <p>Paragraph 2</p>
<p>Both Paragraphs 1 & 2 are written in one line in our code, But browser create a block of text and starts a new line</p>
<p>
Paragraph which
has many
new lines,
but browser
ignores it
</p>
<p>paragraph which have many extra space, but browser ignores them</p>
HTML Line Breaks
The tag <br> means "Break". This tag is used to start a new line without creating a new paragraph. For example:
<p>Paragraphs 1</p>
<br>
<p>Paragraphs 2</p>
HTML Horizontal Rules
The <hr> tag in HTML creates a horizontal line on a webpage. It's used to divide sections of content or show a change in the topic.
<p>Paragraphs 1</p>
<hr>
<p>Paragraphs 2</p>
HTML Prefix
The tag <pre> define "Prefix" and used to display preformatted text (Already fixed text). When using <pre> tag, the content is exactly shown as written, including: space, line brake, special characters like "<" and ">". (Putting special characters in pre would cause error, you can use HTML Entities). What is HTML Entities?
<img src="assets/img/favicon.jpg" height="200px" width="230px">