HTML Element: <header>
[this page | pdf | back links]
The HTML <header> element indicates a
header for a document or section. It is new in HTML 5. Typically, a <header> element might contain
introductory content, navigational links, one or more heading elements (i.e. <h1>, <h2>, <h3>, <h4>, <h5> or <h6>), a logo and
perhaps also some authorship information. A document can contain several <header> elements.
The attributes
it can take are HTML
global attributes and HTML event attributes.
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>
<header>header text</header>
<br><br>Created using JavaScript:<br>
<span id="element"></span>
<script>
var x = document.createElement("HEADER");
x.textContent = "header text";
// or use var txt = document.createTextNode("header text");
// x.appendChild(txt);
document.getElementById("element").appendChild(x);
</script>
</body>
</html>
|
NAVIGATION LINKS
Contents | Prev | Next | HTML Elements