Balise HTML <article>


Exemple

Trois articles au contenu indépendant et autonome :

<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>

Plus d'exemples "Essayez-le vous-même" ci-dessous.


Définition et utilisation

La <article>balise spécifie un contenu indépendant et autonome.

Un article doit avoir du sens en lui-même et il doit pouvoir être diffusé indépendamment du reste du site.

Sources potentielles de l' <article>élément :

  • Message du forum
  • Article de blog
  • Nouvelles histoires

Remarque : L' <article>élément ne s'affiche pas comme quelque chose de spécial dans un navigateur. Cependant, vous pouvez utiliser CSS pour styliser l' <article> élément (voir l'exemple ci-dessous).


Prise en charge du navigateur

Les nombres dans le tableau indiquent la première version du navigateur qui prend entièrement en charge l'élément.

Element
<article> 6.0 9.0 4.0 5.0 11.1

Attributs globaux

La <article>balise prend également en charge les attributs globaux en HTML .


Attributs d'événement

La <article>balise prend également en charge les attributs d'événement en HTML .



Plus d'exemples

Exemple

Utilisez CSS pour styliser l'élément <article> :

<html>
<head>
<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>
</head>
<body>

<article class="all-browsers">
  <h1>Most Popular Browsers</h1>
  <article class="browser">
    <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 class="browser">
    <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 class="browser">
    <h2>Microsoft Edge</h2>
    <p>Microsoft Edge is a web browser developed by Microsoft, released in 2015. Microsoft Edge replaced Internet Explorer.</p>
  </article>
</article>

</body>
</html>

Pages connexes

Référence HTML DOM : Objet Article


Paramètres CSS par défaut

La plupart des navigateurs afficheront l' <article>élément avec les valeurs par défaut suivantes :

article {
  display: block;
}