Jitendra Vyas
Jitendra Vyas

Reputation: 152807

Is <article> tag of HTML5 only to use in blogs?

Is the article tag of HTML5 only to use in blogs? Is it only for blog articles? Is it not to use for the content section of website, which is not a blog?

Generally I use

<div id="content">
<h2> title </h2>
<p> content </p>
</div>

Should I replace div with article

<article id="content">
<h2> title </h2>
<p> content </p>
</article>

or

<div id="content">
<article>
<h2> title </h2>
<p> content </p>
</article>
</div>

Upvotes: 3

Views: 1196

Answers (3)

nageeb
nageeb

Reputation: 2042

One definition that I've read for the new tag, which I find to be the most succinct, is the following:

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.

Eg:
- forum post
- newspaper article
- blog entry
- user comment

If your content that you wish to wrap in tags is self-contained and in a syndication context, then yes. Then again, if the content is just the main section of a web page on a site, then I'd say, don't worry about it.

Upvotes: 0

Kalessin
Kalessin

Reputation: 2302

There's some nice detail about the article element at html5doctor.

In a nutshell, <article> is not limited to blogs and your example

<article id="content">
<h2> title </h2>
<p> content </p>
</article>

would seem to be an ideal use of <article>.

Upvotes: 1

kapa
kapa

Reputation: 78731

From the spec:

The article element represents a component of a page that consists of a self-contained composition in a document, page, application, or site and that is intended to be independently distributable or reusable, e.g. in syndication. This could be a forum post, a magazine or newspaper article, a blog entry, a user-submitted comment, an interactive widget or gadget, or any other independent item of content.

So I guess it is quite dependant on what #content contains. If it would only contain that specific article (or stuff related to that article, like comments nested as further articles), you do not need the div.

My favourite resource about this - HTML5Doctor

Upvotes: 2

Related Questions