Gunther: HTML5: Wann wird <figure> benutzt?

Beitrag lesen

Hallo Siri!

mal so als Beispiel die Startseite von Spiegel online, Focus etc.
Schematisch in HTML/XHTML:

<schnipp>

Daraus würde in HTML5:

<!DOCTYPE html>

<html>
  <head>
    <meta charset="utf-8"/>
    <title></title>
   </head>
  <body>

<section id="content">
      <article>
        <figure><img/><figure>
          <h1></h1>
          <h2><time></time></h2>
          <p></p>
      </article>
      ...
      <article>
      ...
      </article>
    </section>

</body>
</html>

Und schon reingefallen ...! :-P  
Das Section-Element gehört da nicht hin. Stattdessen wird weiter ein DIV-Element verwendet.  
  
  

> Jetzt die Frage: Ist das img-Element auf jeden Fall durch ein figure-Element zu kapseln?  

Laut [Spec](http://dev.w3.org/html5/spec/single-page.html#the-figure-element) nicht.  
  

> Oder nur, wenn es auch eine zugehörige Bildunterschrift hat?  

Nein, das ist nicht das entscheidende Argument. Die figcaption ist optional.  
  

> Gibt es da genau Regeln?  

Vermutlich, aber ich werde aus dem Beispiel in der Spec nicht ganz schlau ...! ;-)  
Dort steht u.a.:"The element can thus be used to annotate illustrations, diagrams, photos, code listings, etc, that are referred to from the main content of the document, but that could, without affecting the flow of the document, be moved away from that primary content, e.g. to the side of the page, to dedicated pages, or to an appendix."  
  
  

> Und btw... Weiß jemand, warum man auf semantische Tags gesetzt hat und nicht auf semantische Attribute (z.B. @semantic)? In manchen Fällen wird es ja eher mehr Code als weniger:  
  
Ich weiß das zwar nicht (steht aber bestimmt irgendwo im Netz), aber ein gravierendes Problem bei deinem Vorschlag/ deiner Variante sehe ich schon alleine beim Zusammenspiel mit CSS.  
  
  
Gruß Gunther