Problème xHTML

Résolu/Fermé
rotsak Messages postés 143 Date d'inscription mercredi 23 septembre 2009 Statut Membre Dernière intervention 2 novembre 2013 - Modifié par rotsak le 8/12/2010 à 19:21
aurelienpm974 Messages postés 131 Date d'inscription mercredi 8 décembre 2010 Statut Membre Dernière intervention 20 février 2011 - 8 déc. 2010 à 19:51
Bonjour,


J'ai un problème au niveau de mon code xHtml...
Voici mon code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" > 
 <head> 
  <title>SilverMoon FR</title> 
         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><!-- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> --> 
  <link rel="stylesheet" type="text/css" href="style.css" /> 
 </head> 
     <body style="background-image:url(imgs/bg.png);"> 
 <p> 
         <img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="CSS Valide !" /> 
   </p> 
 <ul id="image-navigation"> 
  <ul id="text-navigation"> 
   <li><a href="index.html">Accueil</a></li> 
   <li><a href="news.html">News</a></li> 
   <li><a href="laws.html">Règles</a></li> 
   <li><a href="membres.html">Membres</a></li> 
   <li><a href="contact.html">Nous contacter</a></li> 
   <li><a href="partenaires.html">Partenaires</a></li> 
   <li><a href="liens.html">Liens utiles</a></li> 
   <li><a href="images.html">Images</a></li> 
  </ul> 
 </ul> 
 <ul id="logo" />  
 </body> 
</html> 


Et voici les deux erreurs données par le W3C :
# Error Line 14, Column 6: document type does not allow element "ul" here; assuming missing "li" start-tag 
  <ul id="text-navigation"> 

# Error Line 24, Column 6: end tag for "li" omitted, but OMITTAG NO was specified 
  </ul> 

You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">". 


Pour ceux qui souhaitent vérifier quelques choses, voici le CSS (qui n'a aucune erreur) :
body 
{ 
 background-color: #FFFFFF; 
 background-image: url("imgs/bg.png"); 
 background-repeat: no-repeat; 
 background-attachment: fixed; 
} 

ul#image-navigation  
{ 
 background-image: url("imgs/navigation+cadre.png"); 
 background-repeat: no-repeat; 
 margin-top:150px; 
 margin-left:350px; 
 width:1000px; 
 height:650px; 
} 

ul#text-navigation  
{ 
 margin-top:150px; 
 margin-right:300px; 
 width:143px; 
 height:300px; 
} 

ul#logo 
{ 
 margin-top:-250px; 
 background-image: url("imgs/logo.png"); 
 background-repeat: no-repeat; 
 height:205px; 
} 

2 réponses

Doctor C Messages postés 627 Date d'inscription mardi 12 juin 2007 Statut Membre Dernière intervention 19 février 2016 398
8 déc. 2010 à 19:48
Tu sembles utiliser quelques balises ul pour rien.

Si tu veux garder toutes tes listes d'éléments, le code suivant devrait marcher:

<ul id="image-navigation"> 
  <li>   
    <ul id="text-navigation"> 
      <li><a href="index.html">Accueil</a></li> 
      <li><a href="news.html">News</a></li> 
      <li><a href="laws.html">Règles</a></li> 
      <li><a href="membres.html">Membres</a></li> 
      <li><a href="contact.html">Nous contacter</a></li> 
      <li><a href="partenaires.html">Partenaires</a></li> 
      <li><a href="liens.html">Liens utiles</a></li> 
      <li><a href="images.html">Images</a></li> 
    </ul> 
  </li> 
</ul>


Mais le code suivant serait plus approprié:

<div id="image-navigation">  
    <ul id="text-navigation"> 
      <li><a href="index.html">Accueil</a></li> 
      <li><a href="news.html">News</a></li> 
      <li><a href="laws.html">Règles</a></li> 
      <li><a href="membres.html">Membres</a></li> 
      <li><a href="contact.html">Nous contacter</a></li> 
      <li><a href="partenaires.html">Partenaires</a></li> 
      <li><a href="liens.html">Liens utiles</a></li> 
      <li><a href="images.html">Images</a></li> 
    </ul> 
</div>

4
aurelienpm974 Messages postés 131 Date d'inscription mercredi 8 décembre 2010 Statut Membre Dernière intervention 20 février 2011 7
8 déc. 2010 à 19:51
oui Doctor C dit la vérité
-2