Znacznik HTML <hr>


Przykład

Użyj tagu <hr>, aby zdefiniować zmiany tematyczne w treści:

<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>

Więcej przykładów „Wypróbuj sam” poniżej.


Definicja i użycie

Tag <hr>definiuje przerwę tematyczną na stronie HTML (np. przesunięcie tematu).

Element <hr>jest najczęściej wyświetlany jako pozioma linia, która służy do oddzielania treści (lub definiowania zmiany) na stronie HTML.


Obsługa przeglądarki

Element
<hr> Yes Yes Yes Yes Yes

Atrybuty globalne

Znacznik <hr>obsługuje również atrybuty globalne w HTML .


Atrybuty wydarzenia

Tag <hr>obsługuje również Atrybuty Zdarzeń w HTML .



Więcej przykładów

Przykład

Wyrównaj element <hr> (z CSS):

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

Przykład

Noshaded <hr> (z CSS):

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

Przykład

Ustaw wysokość elementu <hr> (za pomocą CSS):

<hr style="height:30px">

Przykład

Ustaw szerokość elementu <hr> (za pomocą CSS):

<hr style="width:50%">

Powiązane strony

Odniesienie HTML DOM: Obiekt HR


Domyślne ustawienia CSS

Większość przeglądarek wyświetla <hr>element z następującymi wartościami domyślnymi:

Przykład

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