/

HTML / CSS / JavaScript Tutorial

HTML Element: <hr>

[this page | pdf | back links]

The HTML <hr> element indicates a thematic change in the content. Often it is rendered as a line across the window.

 

The attributes it can take are HTML global attributes and HTML event attributes.

 

It used to support the align, noshade, size and width attributes, but these are no longer supported in HTML 5.

 

To create or access such an element in JavaScript see here. The corresponding HTML DOM object supports standard DOM properties and methods. The default style applicable to this element is shown here.

 

EXAMPLE:


HTML USED IN THIS EXAMPLE:
<!DOCTYPE html>
<html> <!-- Copyright (c) Nematrian Limited 2018 -->
<head></head>
<body>
Created using HTML:<br>
Text broken using a horizontal rule between here <hr> and here

<br><br>Created using JavaScript:<br>
<span id="element"></span>

<script>
var y = document.getElementById("element");
var txt1 = document.createTextNode("Text broken using a horizontal rule between here ");
y.appendChild(txt1);
var x = document.createElement("HR");
y.appendChild(x);
var txt2 = document.createTextNode(" and here");
y.appendChild(txt2);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Elements


Desktop view | Switch to Mobile