PDA

View Full Version : Validation Error


zac
11-29-2005, 03:22 AM
I almost have it... getting one last error when I run a CSS validation.

Line 57

Column 123

Element type "img" must be followed by either attribute specifications, ">" or "/>".



The problem code is:

<a href="index.php?showimage=<IMAGE_PREVIOUS_ID>" /><img id="image" src="images/<IMAGE_NAME>" alt="click for next image"width="<IMAGE_WIDTH>" height="<IMAGE_HEIGHT>" />

Any ideas ?

Connie
11-29-2005, 06:51 AM
<a href="index.php?showimage=<IMAGE_PREVIOUS_ID>" /><img id="image" src="images/<IMAGE_NAME>" alt="click for next image"width="<IMAGE_WIDTH>" height="<IMAGE_HEIGHT>" />

must be

<a href="index.php?showimage=<IMAGE_PREVIOUS_ID>">
<img id="image" src="images/<IMAGE_NAME>" alt="click for next image" width="<IMAGE_WIDTH>" height="<IMAGE_HEIGHT>" />
</a>

the tag <a ..> is no stand-alone tag, so it cannot be closed with "/>",
<img..> tag is stand-alone and must be closed with "/>",
there must be a space between different attributes

take the code above and check again!

zac
11-29-2005, 07:05 AM
Perfect! Thanks ! !

tinyblob
11-29-2005, 08:22 AM
It's worth noting that for XHTML compliant tags you must also close <BR> like this:
<BR />.
The effective rule is that if a tag has no closing counterpart (i.e there's only one tag) you must add a trailing slash.