css - 如何水平对齐 css Sprite ?

标签 css button alignment css-sprites

目前我所有的 css Sprite 都是垂直对齐的,而且格式不正确。我将如何水平对齐它们?这是我的其中一个按钮的示例:

a.youtube {
    background: url(images/icons.png) no-repeat 0 0;
    height: 64px;
    width: 64px;
    display: block;
    background-position: 0 -128px;
}

a.youtube:hover {
    background-position: -64px -128px;
}

我现在无法使用此方法将它们对齐到中心:

#social_cont {
    text-align: center;
    background: url(images/banners/banner1.jpg);
    height: 254px;
}

和这个 html:

<div id="social">
    <a class="facebook" href="http://facebook.com/projectstratos"></a><a class="twitter" href="http://twitter.com/projectstratos"></a>
</div>

最佳答案

你可以先看看这个:

http://www.w3schools.com/css/css_align.asp

如果它不适合你,手动定位:

http://www.w3schools.com/css/pr_class_position.asp

关于css - 如何水平对齐 css Sprite ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5203939/

相关文章:

html - 需要帮助导航栏通知按钮

html - 并排对齐按钮 Bootstrap

html - "Fluid"CSS 中的悬挂缩进

javascript - AngularJS:将 HTML 代码显示到 ng-view 及其结果中(以导航形式,如 Html、Css、JS、Result)

swift - 多个按钮执行相同的 takePicture Action Swift

html - 文本进度条(电子邮件)

java - 如何在 Java 中制作非 Swing 按钮?

html - 如何水平居中包含图像的 div block ?

javascript - 我的 js 脚本会因在旧版浏览器上设置 css --variables 而中断吗?

html - 在某些页面上显示页脚