
Originally Posted by
jigarshah

Originally Posted by
mwinter
At best, you could add a class attribute to the anchors with or without an image child element, though an alternative would be to add span elements to the image-less anchors and add the background to that, rather than the anchor itself.
Thanks for your help. Can you show me sample for both. I m not tht good at CSS

The class attribute route:
Code:
#content a.no-image:hover {
text-decoration: none;
padding-bottom: 2px;
background: url(images/flash2.gif) bottom left repeat-x;
}
HTML Code:
<a class="no-image" href="...">...</a>
<a href="..."><img alt="..." src="..."></a>
Three notes, here:
- Choose a better, more meaningful class name than 'no-image', if possible. I don't know exactly what you're marking-up, so that choice will have to be yours.
- If you use a background image, it is often a good idea to specify a background colour, too. Disable images and ensure that the foreground content can still be read easily without the background image. If it cannot, add a suitable colour.
- A foreground colour (color property) should be paired with any background-related declaration that specifies an image or colour. Relying on defaults can lead to clashes should a user have a different default scheme.
The span child approach:
Code:
#content a:hover span {
text-decoration: none;
padding-bottom: 2px;
background: url(images/flash2.gif) bottom left repeat-x;
}
HTML Code:
<a href="..."><span>...</span></a>
<a href="..."><img alt="..." src="..."></a>
Hope that helps,
Mike
Bookmarks