Horje
HTML <article> Tag

The <article> tag specifies independent, self-contained content.

An article should make sense on its own and it should be possible to distribute it independently from the rest of the site.

Potential sources for the <article> element:

  • Forum post
  • Blog post
  • News story

Note: The <article> element does not render as anything special in a browser. However, you can use CSS to style the <article> element (see example below).


How to create HTML <article> Tag

Three articles with independent, self-contained content:
index.html
Example: HTML
 <article>
<h2>Google Chrome</h2>
<p>Google Chrome is a web browser developed by Google, released in 2008. Chrome is the world's most popular web browser today!</p>
</article>

<article>
<h2>Mozilla Firefox</h2>
<p>Mozilla Firefox is an open-source web browser developed by Mozilla. Firefox has been the second most popular web browser since January, 2018.</p>
</article>

<article>
<h2>Microsoft Edge</h2>
<p>Microsoft Edge is a web browser developed by Microsoft, released in 2015. Microsoft Edge replaced Internet Explorer.</p>
</article> 

Output should be:

How to create HTML <article> Tag

Browser Support for HTML <article> Tag

The numbers in the table specify the first browser version that fully supports the element.

Output should be:

Browser Support for HTML <article> Tag

How to Use CSS to style the <article> element:

The article element - Styled with CSS
index.html
Example: HTML
<style>
.all-browsers {
  margin: 0;
  padding: 5px;
  background-color: lightgray;
}

.all-browsers > h1, .browser {
  margin: 10px;
  padding: 5px;
}

.browser {
  background: white;
}

.browser > h2, p {
  margin: 4px;
  font-size: 90%;
}
</style>

Output should be:

How to Use CSS to style the <article> element:

How to edit Default CSS Settings for HTML <article> Tag

index.html
Example: HTML
<style>
article {
  display: block;
  color: blue;
}
</style>

Output should be:

How to edit Default CSS Settings for HTML <article> Tag





Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin


Read Article
https://horje.com/learn/1434/reference