Page 1 sur 1

Validation XHTML

Posté : 29 févr. 2008, 12:49
par Photographiquement Vôtre
Bonjour,

Lors de ma validation j'ai plusieurs messages concernant ma table
<table width="820" height="820" align="center" border="0" cellspacing="0" cellpadding="0" >
<!-- Photos -->
	<tr align="center" width="700" height="350">
		<td align="center" width="350" height="350" bgcolor="#666666">
   			<a href="portrait.php"><img src="/images/Portrait_Index.jpg "  width="350" height="350" border="0"></img></a>
   		</td>
   		<td align="center" width="350" height="350" bgcolor="#666666">
   			<a href="beaute.php"><img src="/images/Beaute_Index.jpg " width="350" height="350" border="0"></img></a>
   		</td>
   <!--		<td align="center" width="350" height="350" bgcolor="#666666">
   			<a href="homme.php"><img src="/images/Homme_Index.jpg " width="350" height="350" border="0"></a>
   		</td> -->
    </tr>
    <tr align="center" width="700" height="20">
    	<td width="350">Portraits</td>
    	<td width="350">Beauté</td>
    <!--	<td width="350">Homme</td> -->
    </tr>
    
   	<tr align="center" width="600" height="200">
   		<td align="center" width="350" height="350" bgcolor="#666666">
	   		<a href="mode.php"><img src="/images/Mode_Index.jpg " width="350" height="350" border="0"></img></a>
	   	</td>
	   	<td align="center" width="350" height="350" bgcolor="#666666">	
 	   		<a href="mode.php"><img src="/images/Lingerie_Index.jpg " width="350" height="350" border="0"></img></a>
 	   	</td>
   		</tr>
   	<tr align="center" width="700" height="20">
    	<td width="350">Mode</td>
    	<td width="350">Lingerie</td>	
   	</tr>	
</table>
Quelques Messages :

Line 82, Column 26: there is no attribute "height".
<table width="820" height="820" align="center" border="0" cellspacing="0" cellpa✉

Line 82, Column 38: there is no attribute "align".
<table width="820" height="820" align="center" border="0" cellspacing="0" cellpa

Line 84, Column 26: there is no attribute "width".
<tr align="center" width="700" height="350">

Line 86, Column 104: required attribute "alt" not specified.
… width="350" height="350" border="0"></img></a>✉

Line 124, Column 85: there is no attribute "target".
…ef="http://www.cqfdmedia.com" target="_blank">CQFD Media</a> ✉


A qoui cela est ce du

Merci pour votre aide

Posté : 29 févr. 2008, 12:57
par Calimero
Cela est dû au fait qu'en XHTML (contrairement au HTML), la plupart des attributs de balise de présentation (tels que align, width, height) ont disparu. Ils ne sont plus valides et le validateur te le signale. Il faut maintenant utiliser des styles CSS pour accomplir ces tâches.

par exemple width="50" doit être remplacé par un style="width:50px"

Tu as deux choix : soit tu passes ton document en HTML (sachant que ça peut casser d'autres choses), soit tu effectues les modifications que le validateur t'indique ;-)

Je ne peux que t'encourager à aller lire l'excellent site Openweb qui foisonne de documentations claires et pratiques sur les différences entre XHTML et HTML notamment.

Posté : 29 févr. 2008, 13:20
par Photographiquement Vôtre
OK je vais changer

Merci

Posté : 29 févr. 2008, 14:05
par Calimero

Posté : 29 févr. 2008, 14:07
par AB
Certains attributs sont encore autorisés pour les tables (cellpadding, cellspacing) mais pour le reste prend l'habitude de faire comme t'a conseillé Calimero. Si tu n'es pas sûr, lui il est sûr.

Quant au target="_blank" ce n'est pas valide strict. Il faut passer par du JS pour faire l'équivalent

Code : Tout sélectionner

<a href="http://tonlien" onclick="window.open(this.href);return false">lien</a>
Mais si JS est désactivé (peu fréquent) le lien s'ouvrira dans la même page.

EDIT Bon j'ai vu que tu avais changé ton message ... et que Calimero t'avais répondu entre temps :wink:

Posté : 01 mars 2008, 00:57
par Victor BRITO
Cela est dû au fait qu'en XHTML (contrairement au HTML), la plupart des attributs de balise de présentation (tels que align, width, height) ont disparu. Ils ne sont plus valides et le validateur te le signale. Il faut maintenant utiliser des styles CSS pour accomplir ces tâches.

par exemple width="50" doit être remplacé par un style="width:50px".
Cette remarque est aussi valable en HTML 4.01 Strict. Et en XHTML 1.0 Transitional, les attributs width et height sont autorisés pour les éléments internes aux tableaux. ;)