HTML <hr> Tag

Introduction to HTML <hr> Tag

HTML में <hr> tag thematic break (विषय अंतराल) को दर्शाने के लिए use किया जाता है। यह tag एक horizontal line generate करता है जिसे अलग अलग विषयों को separate करने के लिए use किया जा सकता है। इसे HTML में horizontal rule भी कहा जाता है।

HTML5 में <hr> tag thematic break को define करता है और पुराने versions में यह horizontal rule (line) create करने के लिए use किया जाता था।

उदाहरण के लिए आप कोई story लिख रहे तो उस story में किसी दृश्य के बदलाव को आप <hr> tag द्वारा separate करके लिख सकते है। यदि आप कोई article लिख रहे है जिसमें आप अलग अलग विषयों पर अपने विचार दे रहे है तो उन विषयों को भी आप <hr> tag द्वारा separate कर सकते है।

हालाँकि <hr> tag HTML5 में भी horizontal line generate करता है लेकिन HTML5 में इसके अर्थ (separating content change) पर ज़ोर दिया गया है और पुराने versions में इस tag के presentation (drawing line) पर ज़ोर दिया गया था।

<hr> tag को <section> tag के साथ confuse नहीं किया जाना चाहिए। <hr> tag एक article के अलग अलग topics को separate करता है। जबकि <section> tag एक web page में अलग अलग sections define करने के लिए use किया जाता है।

Syntax of HTML <hr> Tag

<hr> tag का general syntax निचे दिया जा रहा है।

<hr>

जैसा की आप ऊपर दिए गए syntax में देख सकते है <hr> tag का कोई end tag नहीं होता है। यह एक empty tag होता है। लेकिन यदि आप इसका प्रयोग XHTML में कर रहे है तो इसे आपको इस प्रकार close करना होता है।

<hr />

XHTML में आप opening tag में ही forward slash लगा देते है जो opening और ending दोनों ही tags को दर्शाता है।

Attributes of HTML <hr> Tag

<hr> tag के 4 element specific attributes है। लेकिन इन attributes को HTML5 में disable कर दिया गया है।

  • align - इस attribute द्वारा आप <hr> tag का alignment set कर सकते है। इस attribute की left, centre और right तीन possible values हो सकती है।
  • noshade - इस tag के द्वारा आप define कर सकते है की <hr> tag सिर्फ एक ही color में show हो और कोई shade ना use की जाए। इस attribute की value आप noshade ही define करते है।
  • size - इस attribute द्वारा आप <hr> tag की height define कर सकते है। इसकी value आप pixels में define करते है।
  • width - इस attribute द्वारा आप <hr> tag की width define करते है। इसकी value भी आप pixels में ही define करते है।

<hr> tag सभी HTML versions में सभी global और event attributes को support करता है।

Example of HTML <hr> Tag

<hr> tag का उदाहरण निचे दिया जा रहा है।

<html>
<head>
<title>hr tag Demo</title>
</head>

<body>

<h1>hr tag Demo</h1>

<article>
This is first part of article and I am talking about fruits here.
<hr>
This is second part of article and I am talking about cars here.
<hr>
This is another part of article and I am talking about different topic here.
</article>
</body>

</html>

ऊपर दिया गया उदाहरण निचे दिया गया output generate करता है।

HTML hr tag example