View Full Version : Validation problem with DD gallery

04-26-2008, 04:40 PM
1) Script Title: CSS Images

2) Script URL (on DD): http://www.dynamicdrive.com/style/csslibrary/item/css-image-gallery/
Item 4.1

3) Describe problem:

I am puzzled, as when validating a page of images using this gallery I get this:

Line 51, Column 218: required attribute "alt" not specified.

.src="images/hist/lovells-ct-05.jpg" /><br />Visit to Lovells Court 2005</span

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.

Here is line 51
<a class="thumbnail" href="#thumb"><img
src="images/hist/thumb/tn_lovells-ct-05.jpg" width="200px" height="140px"
border="0" alt="photo of Visit to Lovells Court 2005" /><span><img src="images/hist/lovells-ct-05.jpg" /><br />Visit to Lovells Court 2005</span></a>

Being this is a Dynamic drive css gallery, I went back to source and looked at source code. There is no Alt at all and in fact had double the amount of errors when I validated it than I have. ;-))

Can someone please throw some light on how I can correct this code please?

Many thanks

04-26-2008, 05:33 PM
Basically, all image tags must have alt attributes for strict validation. If you have an image tag without an alternate and it wouldn't be appropriate for design purposes to give it one, or you just don't want to, you can give it an empty alt attribute.

In other words, in this particular case, you can just add (red):

<img src="images/hist/lovells-ct-05.jpg" alt="" />

04-27-2008, 10:00 AM
Many thanks John, that works and now validates. Just a case of knowing where the 'alt' needed to go.