HTML značka <hr>


Příklad

Pomocí tagu <hr> definujte tematické změny v obsahu:

<h1>The Main Languages of the Web</h1>

<p>HTML is the standard markup language for creating Web pages. HTML describes the structure of a Web page, and consists of a series of elements. HTML elements tell the browser how to display the content.</p>

<hr>

<p>CSS is a language that describes how HTML elements are to be displayed on screen, paper, or in other media. CSS saves a lot of work, because it can control the layout of multiple web pages all at once.</p>

<hr>

<p>JavaScript is the programming language of HTML and the Web. JavaScript can change HTML content and attribute values. JavaScript can change CSS. JavaScript can hide and show HTML elements, and more.</p>

Další příklady „Vyzkoušejte si to sami“ níže.


Definice a použití

Tag <hr>definuje tematickou přestávku v HTML stránce (např. posun tématu).

Prvek <hr>se nejčastěji zobrazuje jako vodorovné pravidlo, které se používá k oddělení obsahu (nebo definování změny) na stránce HTML.


Podpora prohlížeče

Element
<hr> Yes Yes Yes Yes Yes

Globální atributy

Značka <hr>také podporuje globální atributy v HTML .


Atributy události

Značka <hr>také podporuje atributy událostí v HTML .



Další příklady

Příklad

Zarovnat prvek <hr> (s CSS):

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

Příklad

Noshaded <hr> (s CSS):

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

Příklad

Nastavte výšku prvku <hr> (pomocí CSS):

<hr style="height:30px">

Příklad

Nastavte šířku prvku <hr> (pomocí CSS):

<hr style="width:50%">

Související stránky

HTML DOM reference: HR Object


Výchozí nastavení CSS

Většina prohlížečů zobrazí <hr>prvek s následujícími výchozími hodnotami:

Příklad

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