Tag HTML <hr>


Esempio

Usa il tag <hr> per definire le modifiche tematiche nel contenuto:

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

Altri esempi "Provalo da solo" di seguito.


Definizione e utilizzo

Il <hr>tag definisce un'interruzione tematica in una pagina HTML (ad es. uno spostamento di argomento).

L' <hr>elemento viene spesso visualizzato come una regola orizzontale utilizzata per separare il contenuto (o definire una modifica) in una pagina HTML.


Supporto browser

Element
<hr> Yes Yes Yes Yes Yes

Attributi globali

Il <hr>tag supporta anche gli attributi globali in HTML .


Attributi dell'evento

Il <hr>tag supporta anche gli attributi dell'evento in HTML .



Altri esempi

Esempio

Allinea un elemento <hr> (con CSS):

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

Esempio

A noshaded <hr> (con CSS):

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

Esempio

Imposta l'altezza di un elemento <hr> (con CSS):

<hr style="height:30px">

Esempio

Imposta la larghezza di un elemento <hr> (con CSS):

<hr style="width:50%">

Pagine correlate

Riferimento HTML DOM: Oggetto HR


Impostazioni CSS predefinite

La maggior parte dei browser visualizzerà l' <hr>elemento con i seguenti valori predefiniti:

Esempio

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