As discussed in an earlier article on HTMLGoodies, HTML5 introduced a lot of new markup elements to enable rich web authoring.
The “article” markup element is one of the new sectioning elements introduced in HTML5.
The HTML5 specification defines “article” markup element as a self-contained composition in a document, page that is independently reusable in syndication.
It can be used for a newspaper article, a blog entry or a forum post, or any independent item of content.
Few notes facts about “article” markup element
Article markup element can be used where flow content is expected.
The “article” markup elements are global attributes.
The “article” element uses “HTMLElement”.
An “article” markup element can have headers
An “article” markup element can have footers.
“Article” markup elements can be nested.
When “article” elements are nested, the nested elements should be principally related to the parent article. A classic example would be comments on a blog post are related to the blog post.
“Article” markup elements can work with “section” markup elements. However, note that “article” is used when the content is self-contained. HTML5 specification does not dictate that “section” element should have the content which is self-contained.
Using “article” markup element
Simply put, a simple HTML5 webpage using article markup element looks as under.
<!DOCTYPE html>
<html>
<meta charset=”utf-8″>
<title>Article sample</title>
<body>
<article>
<header>
<h1>Article sample</h1>
<p>The First sample using Article markup element</p>
</header>
<footer>
<h1></h1>
<p>HTML Goodies</p>
</footer>
</article>
</body>
</html>
This will result in a display on the web page as under:
Nested “article” markup elements need to put under a section element.
<!DOCTYPE html>
<html>
<meta charset=”utf-8″>
<title>Article sample 2</title>
<body>
<article>
<header>
<h1>Article sample using nested articles</h1>
<p>The Second sample using Article markup element</p>
</header>
<footer>
<h1></h1>
<p>HTML Goodies</p>
</footer>
<section>
<h1>Comments</h1>
<article id=”comment1″>
<footer>
<p>Posted by: Commenter 1</p>
<p><time datetime=”2013-07-26″>1 day ago</time></p>
In this article, we learned about using “article” markup element to represent self-contained information.
About the author
Vipul Patel is a Program Manager currently working at Amazon Corporation. He has formerly worked at Microsoft in the Lync team and in the .NET team (in the Base Class libraries and the Debugging and Profiling team). He can be reached at vipul.patel@hotmail.com
Are you a game developer looking to jump into the futuristic world of virtual reality? If so, you will likely need to use VR game development platforms and tools to help you along the way, and here is a list of some of the best of the bunch to get you started. After reading this […]
While it is possible to create websites in the modern era using content management systems (CMS) like WordPress and website builder platforms like Shopify, it never hurts to learn the cornerstones of those web development tools, especially if you ever want to add your own custom functionality to your websites. What’s more, not every […]
The images in a web page make the page much more attractive, descriptive, and help improve user experience. In this web development tutorial, we will talk about how to work with images in HTML, and, specifically, background images, inline images, image insertion paths, and the most important attributes of the HTML tag. We will […]
Since the Internet first broke on to the scene in the late 80s and 90s, it has undergone a couple of significant changes, encapsulated by Web 1.0 and 2.0. Now, we are entering into the third version of the Web known as Semantic Web or Web 3.0. In this web development tutorial, we will explore […]
The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.
Advertiser Disclosure: Some of the products that appear on
this site are from companies from which TechnologyAdvice
receives compensation. This compensation may impact how and
where products appear on this site including, for example,
the order in which they appear. TechnologyAdvice does not
include all companies or all types of products available in
the marketplace.