HTML Paragraph tag:
HTML paragraph or HTML p tag is used to define a paragraph in a web page or HTML document. Paragraph s are basically blocks of similar content, images, links, etc grouped together and displayed on a web-page. It always starts with a new line and browsers automatically add some white spaces before and after each paragraph. It has a starting <p> and ending</p> tag.
Example:
<p>This is first paragraph.</p>
<p>This is second paragraph</p>
<p>This is third paragraph</p>
IMPORTANCE OF HTML Paragraph tag:
- Paragraphs give a structural view to the document making it more readable.
- Paragraphs can contain related content such as text, images and forms etc.
- It demarcates a particular block of content from the rst of the content, thus making it easier to comprehend.
PROPERTIES OF HTML Paragraph:
- The browser add some white spaces before and after each paragraph.
- Multiple spaces specified by the user, within a paragraph are reduced to single space by the browser.
- Similarly multiple lines entered within a paragraph are reduced to a single line.
- Browsers separate the paragraphs by a blank line.
SPACE INSIDE HTML Paragraph:
If you put a lot of spaces inside the HTML <p> tag browser removes extra spaces and extra line while displaying the page. The browser counts number of spaces and lines as a single one.
Example:
<p>
I am toing to provide
you a tutorial on HTML and
hope that it will be very
beneficial for you.
</p>
<p>
Look I put here a lot of space but I know browser will ignore it.
</p>
<p>You cannot determine the display of HTML because resized windows may crate different result</p>
Output:
USE OF Line Break or <br> tag:
An HTML <br> tag is used for line break and it cab be used with paragraph elements.
Example:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2>use of line break with paragraph tag</h2>
<p>Twinkle, twinkle, little star,<br>
How I wonder what you are!<br>
Up above the world so high,<br>
Like a diamond in the sky.<br>
</p>
</body>
</html>
Output:
USE OF Horizontal Rule or <hr> tag:
An HTML <hr> tag is used to apply a horizontal line between two statements or two paragraphs.
Example:
Output:<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2>use of horizontal line with paragraph tag</h2>
<p>An HTML hr tag draw a horizontal line and separate two paragraphs with that line
<hr>it will start a new paragraph.
</p>
</body>
</html>
Excellent Tutorial...
ReplyDelete