當href的擴展名是.pdf時,我喜歡這麼做; .DOC; .PPT; .xls然後它會在它前面添加相應的文件圖片。然後我試着讓鏈接變得更小,但我沒有做任何事情!我做錯了什麼?CSS - 轉換函數不能在鏈接上工作?
代碼:
ul{
list-style-type: none;
}
ul a{
text-decoration:none;
padding-left: 20px;
background-repeat: no-repeat;
}
ul a:hover{
text-decoration:underline;
color:#666;
-moz-transform: scale(0.9);
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
transform: scale(0.9);
}
a[href$=".pdf"]{
background-image:url(http://i.stack.imgur.com/zJlYq.gif);
}
a[href$=".doc"]{
background-image:url(http://i.stack.imgur.com/z2lbW.gif);
}
a[href$=".ppt"]{
background-image:url(http://i.stack.imgur.com/Tk5Vv.gif);
}
a[href$=".xls"]{
background-image:url(http://i.stack.imgur.com/sOr7E.gif);
}
<ul>
<li><a href="/one.pdf">pdf</a></li>
<li><a href="/two.doc">doc</a></li>
<li><a href="/three.ppt">ppt</a></li>
<li><a href="/four.xls">xls</a></li>
</ul>
http://stackoverflow.com/que stions/30483787/why-is-transformscale-not-keep-on-hover –