HTML <hr>タグ


<hr>タグを使用して、コンテンツのテーマの変更を定義します。

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

以下の「自分で試してみてください」の例をもっと見てください。


定義と使用法

タグは、HTMLページの<hr>主題の区切りを定義します(トピックのシフトなど)。

この<hr>要素は、ほとんどの場合、HTMLページのコンテンツを区切る(または変更を定義する)ために使用される水平方向のルールとして表示されます。


ブラウザのサポート

Element
<hr> Yes Yes Yes Yes Yes

グローバル属性

この<hr>タグは、HTMLのグローバル属性もサポートしています。


イベント属性

この<hr>タグは、HTMLのイベント属性もサポートしています。



その他の例

<hr>要素を(CSSで)整列します。

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

網掛けのない<hr>(CSSを使用):

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

<hr>要素の高さを設定します(CSSを使用)。

<hr style="height:30px">

<hr>要素の幅を設定します(CSSを使用)。

<hr style="width:50%">

関連ページ

HTML DOMリファレンス:HRオブジェクト


デフォルトのCSS設定

ほとんどのブラウザは<hr>、次のデフォルト値で要素を表示します。

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