TOC

This article is currently in the process of being translated into Slovenian (~56% done).

Semantic HTML5 section tags:

The article tag

The article element is one of the new elements that have been introduced with HTML5. As this is a new element there has been some confusion of how to use this element. But there seems to be an agreement that you use the <article> element when you markup content, that makes sense on its own. What does this mean? It means that you could use the <article> element when marking up an “about me" page, a blog entry, and also every comment to your blog entry.
But you are not supposed to use the <article> element around every single paragraph – the point is, whatever you put in the <article> element it is supposed to make sense on its own.

Če uporabljate članek Moke (Flour), je treba element article uporabiti takole (upoštevajte, da sem veliko vsebine zamenjal s tremi pikami, tako da primer ne bo zavzel preveč prostora):

<!DOCTYPE html>
	<body>
	<article>
		<div id="header">
			<h1>All About Flour</h1>
			...
		</div>
		<div id="content">
			<h2>The Two Types of Wheat</h2>
				<p>There are…</p>
			<h2>All-Purpose Flour</h2>
				<p>All-purpose …</p>
			...
		</div>
	</article>
	</body>
</html>

Kot lahko vidite, element <article> vsebuje <div id="header"> in <div id="content"> saj se lahko vsebina v teh dveh <div>ih razume kot celoten članek. Nisem vključil <div id="footer">, ker vsebina v tem elementu nima ničesar z dejanskim člankom, v tem primeru še vedno uporabljamo veliko elementov div, vendar vam v naslednjih poglavjih pokažem, katere nove elemente HTML5 bi morali uporabiti namesto tega.

Včasih potrebujete več kot le en primer in sem vključil še drugega: z uporabo primera za vnos v spletnem dnevniku iz prejšnjih poglavij uporabite element article, da zavijete vsak vnos v blogu, kot je ta:

<article>
	<h1>Just Another Day</h1>
	<p>Written by Christina<br />
	On January 11th </p>
	<p class="content">This is my second blog entry, and I just wanted to check in on you </p>
</article>
<article>
	<h1>My First Blog Entry</h1>
	<p>Written by Christina<br />
	On January 10th </p>
	<p class="content">I’m so happy to write my first blog entry – yay!</p>
</article>

Kaj ste se naučili

  • <article> je nov pomenski element HTML5
  • <article> je treba uporabiti, če ima vsebina smisel sama po sebi (na primer v rss-bralcu)
  • <article> je zelo poseben element – bolj poseben kot npr. element <div>

This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!
adplus-dvertising