【发布时间】:2011-09-28 03:03:52
【问题描述】:
我想获得带有图像的按钮链接。
I did,实际上,使用 CSS:
section a:link, section a:visited {
width: 150px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border-radius: 10px;
-khtml-border-radius: 10px;
color: white;
background: #03c;
padding: 10px 10px 10px 60px;
display: block;
text-decoration: none;
}
section div {
margin-left: 5px;
margin-top: -9px;
width: 50px;
height: 50px;
float: left;
}
.pdf div {
background: transparent url('pdf.png') no-repeat 0 50%;
}
然后是 HTML:
<section class="pdf">
<div></div>
<a href="#">Sheet music (PDF)</a>
</section>
但是没有比使用负边距that don't work in IE7 更好的解决方案吗?我尝试将某个margin-top 放入section a 标签中,但由于页边距折叠,它不起作用。
(哇,我的名声不允许我嵌入图像或添加超过 2 个外部链接。)
【问题讨论】:
-
您的测试用例不包括code.google.com/p/html5shiv,这是使
section等HTML5语义元素在