I have a CSS rule like this:
a:hover { background-color: #fff; }
But this leads to a bad gap at the bottom of the image links, and even worse, if I have transparent images, the color of the link image can be seen through the image.
I have come across this problem many times, but I always solved it with a quick and dirty approach to class assignment for image links:
a.imagelink:hover { background-color: transparent; }
Today I was looking for a more elegant solution to this problem when I came across this .
Basically what he offers uses display: block , and it really solves the problem for opaque images. However, this leads to another problem: now the link is as wide as the paragraph, although the image is missing.
Is there a good way to solve this problem, or do I need to use a dirty approach again?
Thanks,
css
Can berk gΓΌder
source share