Christian: Validator - Frage zu <h>-Tags

Hallo,

ich habe meinen Quelltext durch den W3C-Validator geschickt und habe eine Frage zu einer Fehlermeldung:
---------------
Error Line 16 column 34: document type does not allow element "H2" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag.
    <li><a href="../index.htm"><h2>Home</h2></a></li>
The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
----------------

Der Quelltext auszugsweise:

</head>
<body>

<div id="Seite">
<div id="banner">Seitenueberschrift</div>

<div id="navi">
  <ul id="Navigation">
    <li><a href="../index.htm"><h2>Home</h2></a></li>
    <li><a href="#"><h2>Ueber Uns</h2></a></li>
.........

Was hat das zu bedeuten, warum ist das <h2>-Tag hier Fehl am Platze??

MfG,

Christian

  1. Hi,

    weil es gemäß den Vorschriften für korrekte HTML-Dokumente nur eine begrenzte Zahl von Elementen gibt, die man in das <a> hineinpacken darf, nämlich inline-Elemente (ausgenommen eines weiteren <a>).

    Zum Nachvollziehen:
    Elementreferenz: <a>
    ->
    Inline-Elemente

    MfG
    Rouven

    --
    -------------------
    He is entertaining both out of the car and in the car because if you tell him that a corner is almost flat then he is the guy who is going to try to take it flat even if it means shunting it the other side of it, he will come with the data and say 'hey, I may have crashed and destroyed the car, but I was flat-out'. That is an interesting quality that he has!  --  Team Member on Jacques Villeneuve
  2. Was hat das zu bedeuten, warum ist das <h2>-Tag hier Fehl am Platze??

    Ein <hX>-Element ist ein Block-Element, muss sich also innerhalb von anderen Blockelementen befinden. Du plazierst das <h2> allerdings innerhalb eines <a>, was ein inline-Element ist. Willst du es valide haben, solltest du die <a>-Tags in das <h2> hineinschieben.

    (Zudem baust du noch die <h2>-Elemente (das sind Überschriften!) innerhalb deiner Navigation als Links ein. Das ist zwar theoretisch valide aber ziemlich schwachsinnig)

    Jonathan

  3. One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

    ...

    Was hat das zu bedeuten, warum ist das <h2>-Tag hier Fehl am Platze??

    s.o.

    Struppi.

    --
    Javascript ist toll (Perl auch!)