Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

HTML <hr> Tag


Example

Use the <hr> tag to define thematic changes in the content:

<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>
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The <hr> tag defines a thematic break in an HTML page (e.g. a shift of topic).

The <hr> element is most often displayed as a horizontal rule that is used to separate content (or define a change) in an HTML page.


Browser Support

Element
<hr> Yes Yes Yes Yes Yes

Global Attributes

The <hr> tag also supports the Global Attributes in HTML.


Event Attributes

The <hr> tag also supports the Event Attributes in HTML.



More Examples

Example

Align a <hr> element (with CSS):

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

Example

A noshaded <hr> (with CSS):

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

Example

Set the height of a <hr> element (with CSS):

<hr style="height:30px">
Try it Yourself »

Example

Set the width of a <hr> element (with CSS):

<hr style="width:50%">
Try it Yourself »

Related Pages

HTML DOM reference: HR Object


Default CSS Settings

Most browsers will display the <hr> element with the following default values:

Example

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


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.