开发者

sprite problem with image link

开发者 https://www.devze.com 2022-12-14 00:59 出处:网络
how to use sprite with image links. when i try to use as be开发者_如何学编程low link lost <a target=\"_blank\" rel=\"nofollow\" title=\"link1\" href=\"http://www.yahoo.com\">

how to use sprite with image links. when i try to use as be开发者_如何学编程low link lost

<a target="_blank" rel="nofollow" title="link1" href="http://www.yahoo.com">
    <div id="yahoo1" class="logosprite"></div>
 </a>

css:

#yahoo1.logosprite {
background-position:0 0;
height:16px;
width:16px;
}

can anyone suggest better solution ?


That's not valid markup.

Simply apply the CSS to the anchor and add the following css property so that it is the right size:

display: block;


a elements cannot contain div elements.

Just set the background image on the a itself.

0

精彩评论

暂无评论...
验证码 换一张
取 消