【发布时间】:2016-10-21 21:40:33
【问题描述】:
我有一个包含一些内容的全宽背景图像。
最后,我想将我的按钮放置在中心(垂直和水平),但是使用position:absolute,这不起作用。你可以在JSFiddle看到它。
我的 CSS 中有一些代码行
.buttons{
position:relative;
}
.buttons .button-pos{
width:100%;
position:absolute;
margin:auto;
top:0;
bottom:0;
left:0;
right:0;
}
【问题讨论】:
-
除了下面的@Johannes 答案,您还可以查看W3 Schools article about centering things,这几乎可以解释一切。
标签: html css responsive full-width