/

HTML / CSS / JavaScript Tutorial

HTML Element: <article>

[this page | pdf | back links]

The HTML <article> element indicates a self-contained piece of content, such as a blog or forum post, a specific news story or some self-contained comment on a specific piece of text. It is new in HTML 5.

 

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>
<article>A self-contained piece of text</article>

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

<script>
var x = document.createElement("ARTICLE");
x.textContent = "A self-contained piece of text";
// or use var txt = document.createTextNode("A self-contained piece of text");
// x.appendChild(txt);
document.getElementById("element").appendChild(x);
</script>

</body>
</html>


NAVIGATION LINKS
Contents | Prev | Next | HTML Elements


Desktop view | Switch to Mobile