*curious behavoir* why is font-size over width/height
<html>
<head>
<style type="text/css">
ul {font-size: 25px; list-style: none;}
li{margin-left:0; padding: 0px 5px;}
li a {width: 300px; height: 300px; height:300px; background:url(whatever) bottom left;}
li a span{visibility: hidden;}
</style>
</head>
&l开发者_开发百科t;body>
<ul><li>
<a href="#"><span>some txt</span></a>
</li></ul>
</body>
</html>
why is here the ul's font-size making the width/height and not the witdth/height of the a ?
@remy; a
& span
are inline element
so it's not take the height , width , vertical margin & padding
so give
a , span{
display:block
}
Because an anchor
tag is inline by default. Try adding
li a {
display: block;
}
to convert it to a block; this will mean you can assign it a width & height.
精彩评论