css block links and images
Posted
by Andrew Heath
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Heath
Published on 2010-03-16T13:55:41Z
Indexed on
2010/03/16
14:06 UTC
Read the original article
Hit count: 344
Given this html:
<div class="nation">
<a href="library.php?type=nation&id=America">
<div class="nation-image">
<img src="nations/America.png" alt="snip" />
</div>
<h3>America</h3>
</a>
</div>
the following CSS results in the entire <div class="nation">
becoming a clickable block link:
.nation {float: left; text-align: center; width: 189px;}
.nation img {width: 160px; margin: 10px 0 0 0; border: 1px solid #16160C;}
but if I make the following single addition:
.nation {float: left; text-align: center; width: 189px;}
.nation-image {height: 138px;}
.nation img {width: 160px; margin: 10px 0 0 0; border: 1px solid #16160C;}
to specify the height of <div class="nation-image">
then the image (and only the image) is no longer a link, but the rest of the div (margin around it, h3
etc) remain a block link...
/I am teh confussd :-?
© Stack Overflow or respective owner