What is HTML Line Break?
A line space after text can be given using <br> (or) <br />. It does not have a close tag like </br> as we have in other tags. So it is called a Single tag. However self closing <br /> can be used in some cases.
Where to use?
- Html Line Break can be used to give a break after some texts. Since the break given using “Enter key” while typing the text will not be accepted by the browser. It would treat it as continuous texts.
- It cannot have any attributes. But we can give “Class” for CSS.
- We cannot increase the height of a line space. In case if we need more space another
tag can be used. - This tag is also known as empty tag since no content can be given within this tag. Generally, empty tags have no closing tag.
Example:
<html>
<head>
<title>The page for HTML Line Break</title>
<body>
HTML is easy to learn<br />
It can be used to create web pages<br />
It is also fun to learn html<br />
So Welcome to html tutorial once again
</body>
</html>
<head>
<title>The page for HTML Line Break</title>
<body>
HTML is easy to learn<br />
It can be used to create web pages<br />
It is also fun to learn html<br />
So Welcome to html tutorial once again
</body>
</html>
What is HTML Horizontal Rule?
The <hr> (or) <hr /> tag is used to draw a horizontal line. This tag also has no end tag. So it can be used as self closed.
Where to use?
- It can be used to separate the major sections in a document.
- It can also be used for underlining the headings of an article.
- <hr/> is also empty tag (content cannot be given inside).
How to use?
- Generally the line is drawn to the full width of the page. However it can be controlled by specifying the width using the attribute width=”50%” (or) width=”50px” as per the requirement.
- Default alignment is center. It can also be altered using the align attribute to left or right.
- Moreover the line is not full black in color as default. Some shades appear below and make it look with dark grey color. It can be changed using noshade within the tag.
Example
<html>
<head>
<title>The page for HTML Horizontal Rule</title>
<body>
<h1 align=”center”>HTML tutorial</h1>
<hr noshade width=”300px” align=”center” />
HTML is easy to learn<br />
It can be used to create web pages<br />
It is also fun to learn html<br />
<hr align=”left” />
So Welcome to html tutorial once again
</body>
</html>
<head>
<title>The page for HTML Horizontal Rule</title>
<body>
<h1 align=”center”>HTML tutorial</h1>
<hr noshade width=”300px” align=”center” />
HTML is easy to learn<br />
It can be used to create web pages<br />
It is also fun to learn html<br />
<hr align=”left” />
So Welcome to html tutorial once again
</body>
</html>
In our next tutorial we can see about html formatting tags that are used to format texts in our page.
Advertisement