gpt4 book ai didi

html - Bootstrap - 形式水平对齐

转载 作者:行者123 更新时间:2023-11-28 02:35:44 25 4
gpt4 key购买 nike

我有一个关于 bootstrap form-horizo​​ntal 的问题,问题是我有一个带有两个“form-group col-sm-6”组的水平表单。

看起来两组后面有一个空格(请看向下的蓝色箭头)。

我需要删除该空间,以便两个表单组填充该空间。

form-horizontal

我使用的代码是:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<section class="animated fadeInUp">
<div class="panel panel-default col-md-12">
<div class="panel-heading"> <b class="text-capitalize">CIF Profile</b>
<div class="actions pull-right"> <i class="fa fa-chevron-down"></i> </div>
</div>
<div class="panel-body">
<div class="form-horizontal col-sm-12" style="background-color:red;">
<div class="form-group col-sm-6" style="background-color:blue;">
<div class="col-sm-6">
<label class="control-label">Customer Id</label>
</div>
<div class="col-sm-6">
<input id="txtCustomerId" name="txtCustomerId" class="form-control" value="" maxlength="6" readonly="readonly">
</div>
</div>
<div class="form-group col-sm-6" style="background-color:white;">
<div class="col-sm-6">
<label class="control-label">Mnemonic</label>
</div>
<div class="col-md-6">
<input id="txtMnemonic" name="txtMnemonic" class="form-control" placeholder="" value="" maxlength="10">
</div>
</div>
</div>
</div>
</div>
</section>

最佳答案

Bootstrap 默认有一个 padding 15px,只需添加这个 css,并删除 form-group

.form-horizontal.col-sm-12 {
padding-left: 0px !important;
padding-right: 0px !important;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<section class="animated fadeInUp">
<div class="panel panel-default col-md-12">
<div class="panel-heading"> <b class="text-capitalize">CIF Profile</b>
<div class="actions pull-right"> <i class="fa fa-chevron-down"></i> </div>
</div>
<div class="panel-body">
<div class="form-horizontal col-sm-12" style="background-color:red;">
<div class="col-sm-6" style="background-color:blue;">
<div class="col-sm-6">
<label class="control-label">Customer Id</label>
</div>
<div class="col-sm-6">
<input id="txtCustomerId" name="txtCustomerId" class="form-control" value="" maxlength="6" readonly="readonly">
</div>
</div>
<div class="col-sm-6" style="background-color:white;">
<div class="col-sm-6">
<label class="control-label">Mnemonic</label>
</div>
<div class="col-md-6">
<input id="txtMnemonic" name="txtMnemonic" class="form-control" placeholder="" value="" maxlength="10">
</div>
</div>
<div>I see the red</div>
</div>
</div>
</div>
</section>

关于html - Bootstrap - 形式水平对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47528552/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com