2014-02-15 51 views
2

Bootstrap 3: 我想在面板的中间位置浮动一个按钮中心。但是整个布局是有反应的,所以我需要在屏幕尺寸被调整或更小时仍然是正确的。 我创建了一个bootply,我的尝试很接近,但不会在屏幕大小调整时保持不变。 谢谢, 内特Bootstrap3浮动按钮面板底部

Bootply Trial

回答

3

这是你想要得到什么? 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课程的评论。

+0

谢谢!完美的作品,我知道它必须简单。 – clarnp49

+0

不客气。如果这个答案解决了你的问题,请立即行动并接受答案。 – Ravimallya