At 1/8/2007 11:23 AM, Robin @ Xplore.net wrote:
Could someone please clarify for me the best way to markup an image in a template, take a header image for example. In the interest of keeping structure from content I have recently been using background images wherever possible to keep my markup as clean as possible but I have been reading an article on the importance of the alt text for SEO.
Is there a definitive answer?
I want the best search engine rankings but I also want clean markup.


Background images, not being IMG elements, can't have ALT attributes, so that part's easy. If you've decided that an image is truly decor and doesn't need to be a foreground image, it also doesn't need (and can't have) alt text.

Determining which images are decor and which are truly content can be difficult at times as there can be lots of grey area. One could argue that if the image is not necessary to understanding the page content, it's decor. It helps if you turn images off in your browser and see if the integrity of the page suffers as a result.

The correct markup will depend on whether you're using HTML or XHTML. For XHTML it's:

        <img src="xxxxxxxxx" alt="xxxxxxxxxxxxxx" />

Other attributes are available; see:

HTML 4.01 Specification
13 Objects, Images, and Applets
13.2 Including an image: the IMG element
http://www.w3.org/TR/html4/struct/objects.html#edef-IMG

Regards,
Paul


*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to