如何使我的表单适合手机屏幕上的整行,但在桌面屏幕上保持中间位置?

时间:2015-12-08 00:41:08

标签: html css twitter-bootstrap responsive-design

我努力让我的表单在手机屏幕/ iPad屏幕上占据整行,但是在桌面屏幕中间开始。我应该如何配置我的引导类?

我试过

<div class="col-xs-12 col-sm-12 col-md-12 col-lg-4-offset-4">
//My Form
</div>

结果

Phone尺寸看起来不错

enter image description here

Desktop尺寸看起来很糟糕

enter image description here

2 个答案:

答案 0 :(得分:2)

您的代码中有错误。它应该是这样的

<div class="col-xs-12 col-sm-12 col-md-12 col-lg-4 col-lg-offset-4">
   //My Form
</div>

或者你可以写这个,它会做同样的事情

<div class="col-xs-12 col-lg-4 col-lg-offset-4">
   //My Form
</div>

答案 1 :(得分:2)

而不是col-lg-4-offset-4

你需要使用

col-lg-4 col-lg-offset-4

(即容器宽度为一个类,偏移量为另一个类)