视口大小较小时,表单字段会重叠.当空间不足时,有没有办法在下一行捕捉表单字段?
代码片段:
<form class="compact">
<div class="row">
<div class="col-xs-6">
<section class="form-block">
<div class="form-group">
<label for="aForm_1">This is a form field</label>
<input type="text" id="aForm_1" placeholder="Enter value here" size="45">
</div>
</section>
</div>
<div class="col-xs-6">
<section class="form-block">
<div class="form-group">
<label for="aForm_2">Overlapping Text</label>
<input type="text" id="aForm_2" placeholder="Enter value here" size="45">
</div>
</section>
</div>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
这是plunker:https://embed.plnkr.co/ynfi39fIMk1bc8bSBHAp/
@ X.Vu:请看看这个Plnkr:https://plnkr.co/edit/6YhGmFusvo5EdySzxNpn ? p = preview
以及网格文档中的Clarity Forms:https: //vmware.github.io/clarity/documentation/forms
您需要使用文档中提到的.row类添加该类,.form-group然后使用.col-*表单字段中的类.
<form class="compact">
<section class="form-block">
<div class="form-group row">
<div class="col-md-2 col-sm-6 col-xs-12">
<label for="aForm_1">This is a form field</label>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<input type="text" id="aForm_1" class="form-control" placeholder="Enter value here" size="45">
</div>
<div class="col-md-2 col-sm-6 col-xs-12">
<label for="aForm_2">Overlapping Text</label>
</div>
<div class="col-md-4 col-sm-6 col-xs-12">
<input type="text" id="aForm_2" class="form-control" placeholder="Enter value here" size="45">
</div>
</div>
</section>
</form>
Run Code Online (Sandbox Code Playgroud)
还要注意我已经添加了.form-control类,input因为它input占用了.col-*分配给它的整个空间.
| 归档时间: |
|
| 查看次数: |
47 次 |
| 最近记录: |