Tag <hr> HTML
Contoh
Gunakan tag <hr> untuk menentukan perubahan tematik dalam konten:
<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>
Lebih banyak contoh "Coba Sendiri" di bawah ini.
Definisi dan Penggunaan
Tag <hr>
mendefinisikan jeda tematik dalam halaman HTML (misalnya, pergeseran topik).
Elemen <hr>
ini paling sering ditampilkan sebagai aturan horizontal yang digunakan untuk memisahkan konten (atau menentukan perubahan) di halaman HTML.
Dukungan Peramban
Element | |||||
---|---|---|---|---|---|
<hr> | Yes | Yes | Yes | Yes | Yes |
Atribut Global
Tag <hr>
juga mendukung Atribut Global dalam HTML .
Atribut Acara
Tag <hr>
juga mendukung Atribut Peristiwa dalam HTML .
Lebih Banyak Contoh
Contoh
Sejajarkan elemen <hr> (dengan CSS):
<hr style="width:50%;text-align:left;margin-left:0">
Contoh
<hr> tanpa bayangan (dengan CSS):
<hr style="height:2px;border-width:0;color:gray;background-color:gray">
Contoh
Atur tinggi elemen <hr> (dengan CSS):
<hr style="height:30px">
Contoh
Atur lebar elemen <hr> (dengan CSS):
<hr style="width:50%">
Halaman Terkait
Referensi DOM HTML: Objek HR
Pengaturan CSS Default
Sebagian besar browser akan menampilkan <hr>
elemen dengan nilai default berikut:
Contoh
hr {
display: block;
margin-top: 0.5em;
margin-bottom: 0.5em;
margin-left: auto;
margin-right: auto;
border-style: inset;
border-width: 1px;
}