Bootstrap3浮动按钮面板底部

时间:2014-02-15 18:43:00

标签: twitter-bootstrap-3

Bootstrap 3: 我试图将按钮中心漂浮在面板页脚的中间。但是整个布局都是响应式的,所以我需要在屏幕尺寸调整大小时使用它,或者它仍然是正确的。 我创建了一个bootply,我的尝试很接近,但在屏幕调整大小时不会停留。 谢谢, 内特

Bootply Trial

1 个答案:

答案 0 :(得分:6)

这是你想要的吗? http://www.bootply.com/114327

.relative {
    position: relative;
}

.absolute {
    position: absolute;
}

.bottom-btn {
    left: 50%;
    bottom: -17px; /* half of the button height */
    margin-left: -77px; /* half of the button width */
    /* instead of bottom and margin-left, you can use translateX as well. */
}

使用css position属性并使用margin获取准确位置。查看.bottom-btn类的评论。