我知道这是一个相当简单的问题,但我想不明白该怎么做。我有两个链接,我已经应用了背景图像。以下是当前的外观(抱歉,只是一个按钮的粗略草图):
然而,我希望这两个按钮并排放置。我真的无法确定需要调整什么对齐方式。
以下是HTML代码:
<div id="dB"}>
<a href="http://notareallink.com" title="Download" id="buyButton">Download</a>
</div>
<div id="gB">
<a href="#" title="Gallery" onclick="$j('#galleryDiv').toggle('slow');return false;" id="galleryButton">Gallery</a>
</div>
这是 CSS 代码
#buyButton {
background: url("assets/buy.png") 0 0 no-repeat;
display:block;
height:80px;
width:232px;
text-indent:-9999px;
}
#buyButton:hover{
width: 232px;
height: 80px;
background-position: -232px 0;
}
#buyButton:active {
width: 232px;
height: 80px;
background-position: -464px 0;
}
#galleryButton {
background: url("images/galleryButton.png") 0 0 no-repeat;
display:block;
height:80px;
width:230px;
text-indent:-9999px;
}
#galleryButton:hover{
width: 230px;
height: 80px;
background-position: -230px 0;
}
#galleryButton:active {
width: 230px;
height: 80px;
background-position: -460px 0;
}
float:left;
。 - JCOC611float:left;
应用于两个div
中,可以完美地解决问题。您能否将您的评论发布为答案?谢谢! - sudo rm -rfdisplay: inline-block;
但它的支持程度较差... - J Vfloat:left;
没有任何影响,所以感谢你的建议。 - sudo rm -rf