Results 1 to 8 of 8

Thread: Has the 'alt' attribute for links been deprecated?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2004
    Location
    John Abbott College, Montreal, Canada
    Posts
    79

    Default Has the 'alt' attribute for links been deprecated?

    The W3C's XHTML validator declares the alt attributes on my links to be invalid. I see no reason for this; 'alt' is a valid attribute (unless I'm very mistaken), and I see no strange context that would cause this error. Below are the links in question and the CSS that applies to them. Perhaps someone can enlighten me.

    XHTML 1.0 Strict:
    Code:
    		<div class="box">
    			<h3>Navigation</h3>
    			<h4>Blog (main page)</h4>
    			<h4>Poetry</h4>
    			<h4>Link 2</h4>
    		</div>
    CSS:
    Code:
    .box img	{border: 0px;}
    Quote Originally Posted by W3C
    Line 30, column 37: there is no attribute "alt"

    <h4><a href="paean/paean.php" alt="Link to the poetry section." title="Link t

    You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

    This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

    How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.

  2. #2
    Join Date
    Nov 2004
    Location
    NYS
    Posts
    29

    Default

    http://www.w3.org/TR/REC-html40/stru...ks.html#h-12.2

    There is no alt attribute for links. try:

  3. #3
    Join Date
    Nov 2004
    Location
    John Abbott College, Montreal, Canada
    Posts
    79

    Default

    Hmm. Interesting. Now why do I use alt tags then..? The title attribute works just as well and it's standard, so I'll kill all the alt attributes. Thank you for pointing that out.

  4. #4
    Join Date
    Oct 2004
    Posts
    50

    Default alt is not title

    Pathoschild, there is a difference between alt and title. Indeed, title is more general, while alt is noly used within <IMG /> as a substitute of the image when it cannot be downloaded...

    Moreover, ALT is a MUST for <img />, do not substitute it for title as your page will again not validate... :-)

    regards,
    Tony

  5. #5
    Join Date
    Nov 2004
    Location
    John Abbott College, Montreal, Canada
    Posts
    79

    Default

    Yes, I knew that. However, I for some reason assumed that the alt attribute was needed for Internet Explorer; after trying, I've discovered that the title attribute works just fine in Internet Explorer. I can stop using redundant attributes then.

    I think I've discovered the source of my confusion, though. Firefox doesn't recognize the alt attribute for images for the same "tool tip"-like function that Internet Explorer does. Instead, it will only display a "tool tip" for the title attribute. That brings up an interesting question, though; if the alt attribute is meant as alternate text in case of image failure, should it be displayed as a tool tip if there is no image failure?

  6. #6
    Join Date
    Dec 2004
    Posts
    10

    Default

    Hi,

    w3.org will shows you errors on site everytime you're not using strict ar transitional Documnet version but do not worry too much about w3.org. If you need all correct for SEO if you have less than 100 trivial w3.org "errors" on site your site is "clear" for SEs.

  7. #7
    Join Date
    Oct 2004
    Posts
    50

    Default when alt?

    Quote Originally Posted by Pathoschild
    if the alt attribute is meant as alternate text in case of image failure, should it be displayed as a tool tip if there is no image failure?
    Depends on the particular situation. Text UA's, for instance, should display it instead of the image. Here's what the book says.

    Quote Originally Posted by W3C HTML4.01 Recommendation
    User agents must render alternate text when they cannot support images, they cannot support a certain image type or when they are configured not to display images.

    Values of the title attribute may be rendered by user agents in a variety of ways. For instance, visual browsers frequently display the title as a "tool tip" (a short message that appears when the pointing device pauses over an object). Audio user agents may speak the title information in a similar context. For example, setting the attribute on a link allows user agents (visual and non-visual) to tell users about the nature of the linked resource.

  8. #8
    Join Date
    Nov 2004
    Location
    John Abbott College, Montreal, Canada
    Posts
    79

    Default

    Interesting. In that case, to accomodate screen readers, I'll add the title tag (as well as the alt tag) to images that serve as links.

    At the moment, my website is (a) written in valid XHTML 1.0 Strict and CSS, (b) fully accessibly as required by WAI and Section 508, (c) fully compatible will all modern browsers (to my knowledge), and (d) licensed under Creative Commons licenses. As you can see, Nikolaj, I'm somewhat supportive of standards.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •