Skip to content Skip to sidebar Skip to footer

CSS Background-image : Url("...") Properties Have Also ALT?

I am inserting images in TD's in a table with style='background-image: url('my_url_goes_here') Then I apply a transparent PNG mask in that TD so that it rounds the image corners (s

Solution 1:

  1. No, you can't add alt to background images
  2. Yes, it's possible - http://jsfiddle.net/TyFM7/

Solution 2:

No css does not suppport the alt tag.

As for rounding image corners with CSS that is possible.

http://www.css3.info/preview/rounded-border/


Solution 3:

The alt attribute is meant to provide a text-equivalent in the absence of a loaded resource. It doesn't go in background images, it goes on images, areas, etc.

Source: http://www.w3.org/TR/html4/struct/objects.html#h-13.8

As for rounded corners, border-radius works on images as well - even in IE. If you want to see the current best approach to providing styles for this property, check out http://css3please.com.

img.rounded {
    -webkit-border-radius: 12px;
    border-radius: 12px;
}

Solution 4:

You don't need alt tags for background images, as you wouldn't want these actually indexed.

CSS border radius can be added to most things, here is an example of an image with the border radius added:

Example of image with 30px border radius


Post a Comment for "CSS Background-image : Url("...") Properties Have Also ALT?"