HTML5: Create an HTML document which uses article element?
Solution:
HTML Code :
<!DOCTYPE html><!-- Specifies the document type as HTML -->
<html><!-- Starts the HTML document -->
<head><!-- Contains metadata about the HTML document -->
<meta charset="utf-8"><!-- Defines the character encoding for the document as UTF-8 -->
<title>Create an HTML document which uses article element</title><!-- Sets the title of the HTML page -->
</head>
<body><!-- Contains the visible content of the HTML document -->
<article><!-- Represents an article content -->
<h1>Tutorial of HTML5 article element</h1><!-- Defines the main heading of the article -->
<p>HTML5 article element represents independent item like a blog entry in an web document.</p><!-- Provides the content of the article -->
</article><!-- Ends the article content -->
</body>
</html>
Explanation:
- The <!DOCTYPE html> declaration specifies the document type and version of HTML.
- The <html> element is the root element of the HTML document.
- The <head> section contains metadata about the HTML document, such as the character encoding and title.
- The <meta> tag defines metadata for the HTML document, such as the character encoding, specified here as UTF-8.
- The <title> tag sets the title of the HTML page.
- The <body> element contains the visible content of the HTML document.
- The <article> element defines an independent piece of content that can be distributed or reused independently.
- The <h1> element represents the main heading of the article.
- The <p> element contains the content of the article, describing the purpose of the HTML5 article element.
Live Demo:
See the Pen article-answer by w3resource (@w3resource) on CodePen.
See the solution in the browser
Supported browser
Yes | Yes | Yes | Yes | Yes |
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics