HTML <hr> tag

Definitie en gebruik

<hr> Tags definiëren thematische scheidingen in HTML-pagina's (bijvoorbeeld, verandering van onderwerp).

<hr> Elementen worden meestal weergegeven als horizontale lijnen, gebruikt om inhoud op een HTML-pagina te scheiden of veranderingen in de inhoud te definiëren.

Zie ook:

HTML DOM-handboek:HR-object

Voorbeeld

Voorbeeld 1

Gebruik <hr> Tags om thematische veranderingen in de inhoud te definiëren:

<h1>Hoofdtaal van het web</h1>
<p>HTML is de standaard markertaal voor het maken van webpagina's. HTML beschrijft de structuur van webpagina's, die bestaan uit een reeks elementen...</p>
<hr>
<p>CSS is een taal om het weergavegedrag van HTML-elementen op het scherm, papier of andere media te beschrijven...</p>
<hr>
<p>JavaScript is de programmeertaal van HTML en het web. JavaScript kan HTML-inhoud en eigenschappen wijzigen...</p>

Try it yourself

Voorbeeld 2

Alineatie <hr> Element (Gebruik CSS):

<hr style="width:50%;text-align:left;margin-left:0">

Try it yourself

Voorbeeld 3

Zonder schaduw <hr> (Gebruik CSS):

<hr style="height:2px;border-width:0;color:gray;background-color:gray">

Try it yourself

Example 4

Set <hr> Element height (using CSS):

<hr style="height:30px">

Try it yourself

Example 5

Set <hr> Element width (using CSS):

<hr style="width:50%">

Try it yourself

Global attributes

<hr> The tag also supports Global attributes in HTML.

event attributes

<hr> The tag also supports Event attributes in HTML.

Default CSS settings

Most browsers will display the following default values <hr> Element:

hr {
  display: block;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  margin-left: auto;
  margin-right: auto;
  border-style: inset;
  border-width: 1px;
}

Try it yourself

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support