html css:背景图片链接css写法

图片作为背景,并且是链接的写法。例如网站的logo图片。例如:土豆的logo图片

<a title="土豆网 tudou.com 每个人都是生活的导演" href="http://www.tudou.com">土豆网</a>

a {displayblock;width170px;height42px;text-indent-9999px;backgroundurl(/skin/__g/img/ui/nav/v2_v6.png) 0 0 no-repeat;}
由于z-indent的原因土豆网三个字是不会显示的。title属性是鼠标指向会显示的文本。

<a><span>链接背景图片,在正常情况下是显示不全的,因为<a>链接是行内元素,并且对于a标签css中width height属性失效。

改进方法,就是css中display:block;或者display:inline-block;然后设置width和height。

原文地址:https://www.cnblogs.com/js-html/p/3399619.html