我正在使用bootstrap 3并尝试拼凑烧瓶应用程序的基本布局。到目前为止我有:
<div class="container">
<div class="row">
<div class="content">
<div class="pull-middle">
<h1 class="page-header">Create an awesome App template with Bootstrap.</h1>
<div class="container">
{% block content %}
{% endblock %}
</div>
<div class="panel panel-default ">
<div class="panel-body ">
<form action="#" role="form col-xs-4">
<div class="input-group ">
<input type="email" class="form-control" placeholder="Email Address" required>
<span class="input-group-btn">
<button class="btn btn-success btn-circle" type="submit">Sign up for free</button>
</span>
</div>
</form>
</div>
</div>
</div>
</div>
<footer class="footer text-center">
<div class="container">
<small>© Copyright 2015. </small>
</div>
</footer>
我想将电子邮件地址格式缩小到4-6列并将其居中(大约为红色方块的大小),将绿色按钮保持原样。到目前为止,我已尝试将col-xs-4添加到基于http://jsfiddle.net/tX3ae/225/的各种类中,但尚未弄清楚如何使其正常工作。我怎么能这样做?
答案 0 :(得分:1)
Bootstrap的行和列类不是设计为无可奈何地添加。行元素应始终只有列元素作为其直接子元素。同样,列元素应始终是行元素的直接子元素。
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="content">
<div class="pull-middle">
<h1 class="page-header">Create an awesome App template with Bootstrap.</h1>
<div class="container">
{% block content %}
{% endblock %}
</div>
<div class="row">
<div class="col-xs-12 col-md-8 col-md-offset-2 col-lg-4 col-lg-offset-4">
<div class="panel panel-default ">
<div class="panel-body ">
<form action="#" role="form">
<div class="input-group ">
<input type="email" class="form-control" placeholder="Email Address" required>
<span class="input-group-btn">
<button class="btn btn-success btn-circle" type="submit">Sign up for free</button>
</span>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<footer class="footer text-center">
<div class="container">
<small>© Copyright 2015. </small>
</div>
</footer>
...
查看文档了解更多详情: http://getbootstrap.com/css/#grid