2014-02-15 48 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