The HTML <hr> tag is used to separate the content according to the subject. This tag generates a horizontal line that can be used to separate different topics. It is also called horizontal rule in HTML. In HTML5, the <hr> tag defines the thematic break and in old versions, it was used to create a horizontal rule.
For example, if you are writing an article in which you are giving your thoughts on different subjects, you can separate those topics by <hr> tag. The <hr> tag should not be confused with the <section> tag. <hr> tag separates different topics of an article whereas <section> tag is used to define different sections in a web page.
How to use HTML <hr> and <br> Tag?
Syntax of HTML <hr> Tag
The general syntax for <hr> tag is given below.
<hr>
As you can see in the syntax, there is no end tag of <hr> tag. This is an empty tag. But if you are using it in XHTML, then you have to close it..
<hr/>
In XHTML, you put forward slash in the opening tag, which shows both the opening and the end tags.
Attributes of HTML <hr> Tag
There are four attributes of the <hr> tag but these attributes don’t support in HTML5 because these are disabled in HTML5.
align
With this attribute, you can set the alignment of <hr> tag. This attribute can have left, center and right three possible values.
noshade
By this tag, you can define that <hr> tag should be shown in only one color and no shade should be used. The value of this attribute defines you noshade itself.
size
By this attribute, you can define the height of the <hr> tag. You can define its value in pixels.
width
With this attribute, you define the width of the <hr> tag. Its value also defines you in pixels. <hr> tag supports all global and event attributes in all HTML versions.
Example of HTML <hr> Tag
The above example produces output as below.
![]() |
HTML-HR-TAG |
The tag in HTML is used to break the line in a text or paragraph. This tag is important for situations in which the line break is important. For example, when writing a poem or address, you can use this tag to break the text line.
HTML <br> tag should not be used to increase the gap between lines or paragraphs. For this, you can either use different <p> (paragraph) tag or CSS margin property.
An advanced version of this tag is introduced in HTML5 which is known as <wbr> tag. The text line is broken by <br> tag, by the same <wbr> tag you can suggest to the browser that the text line has to break if the screen size is low.
Syntax of HTML <br> Tag
The general syntax for defining the tag in HTML is being given below.
text <br> text
As you can see in the syntax, the tag is defined in the middle of the text, it is an inline tag. There is no end tag of <br> tag in HTML. This is an empty tag.
In XHTML, the <br> tag is defined differently. Its syntax is given below.
text <br/> text
As you can see in the syntax above, the <br> tag in XHTML is defined as a self-closing tag. The main reason for this is that XML does not allow any tag to be open. Therefore, whenever you use a tag in XHTML, it will define it as a self-closing tag.
XHTML <br> tag syntax is also allowed in HTML. So you should use XHTML as the syntax because it is allowed in both and does not cause confusion.
Attributes of HTML <br> Tag
Example of HTML <br> Tag
The use of the <br> tag in the lower HTML is explained by the example.
The above example produces output as below.
Way cool! Some very valid points! I appreciate you penning this write-up plus the rest of the website is
ReplyDeletealso very good.
By the way, I heard about this awsome affiliate program for Instagram influencers.
Better apply soon before all the spots are filled up.
Here is the link: http://qtx.de/383sk
Good way of telling, and good post to obtain information about my presentation focus,
ReplyDeletewhich i am going to present in school.