Balise HTML <hr>
Exemple
Utilisez la balise <hr> pour définir des changements thématiques dans le contenu :
<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>
Plus d'exemples "Essayez-le vous-même" ci-dessous.
Définition et utilisation
La <hr>
balise définit une rupture thématique dans une page HTML (par exemple un changement de sujet).
L' <hr>
élément est le plus souvent affiché sous la forme d'une règle horizontale utilisée pour séparer le contenu (ou définir un changement) dans une page HTML.
Prise en charge du navigateur
Element | |||||
---|---|---|---|---|---|
<hr> | Yes | Yes | Yes | Yes | Yes |
Attributs globaux
La <hr>
balise prend également en charge les attributs globaux en HTML .
Attributs d'événement
La <hr>
balise prend également en charge les attributs d'événement en HTML .
Plus d'exemples
Exemple
Aligner un élément <hr> (avec CSS) :
<hr style="width:50%;text-align:left;margin-left:0">
Exemple
Un <hr> noshaded (avec CSS) :
<hr style="height:2px;border-width:0;color:gray;background-color:gray">
Exemple
Définissez la hauteur d'un élément <hr> (avec CSS) :
<hr style="height:30px">
Exemple
Définissez la largeur d'un élément <hr> (avec CSS) :
<hr style="width:50%">
Pages connexes
Référence HTML DOM : Objet HR
Paramètres CSS par défaut
La plupart des navigateurs afficheront l' <hr>
élément avec les valeurs par défaut suivantes :
Exemple
hr {
display: block;
margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: auto;
margin-right: auto;
border-style: inset;
border-width: 1px;
}