gpt4 book ai didi

twitter-bootstrap - Bootstrap modal-body 上的行没有间隙吗?

转载 作者:行者123 更新时间:2023-12-04 16:35:28 26 4
gpt4 key购买 nike

在我的 Bootstrap 模式中,我有两行,但它们都挤在一起,行之间没有间距。

问题:为什么 Bootstrap 模态体上的行之间没有间隙,解决这个问题的最佳解决方案是什么?

代码预览 Click Here

完整预览 Click Here

enter image description here

HTML

<div class="container">
<hr>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Click To Open Modal
</button>
</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<a href="" id="button-parent" class="btn btn-default">Parent Folder</a>
<a href="" id="button-refresh" class="btn btn-default">Refresh Page</a>
<button type="button" id="button-upload" class="btn btn-primary">Upload</button>
<button type="button" id="button-folder" class="btn btn-default">Create Folder</button>
<button type="button" id="button-delete" class="btn btn-danger">Delete</button>
</div>
</div>

<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="input-group">
<input type="text" name="search" value="" placeholder="" class="form-control">
<span class="input-group-btn">
<button type="button" data-toggle="tooltip" title="<?php echo $button_search; ?>" id="button-search" class="btn btn-primary"><i class="fa fa-search"></i></button>
</span>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>

最佳答案

每当您在 bootstrap 中使用 form-elements 时,建议您将该特定元素放入 form-group 类中 - 这样,每个元素下方都有一个 15px 的 margin-bottom。

As per Bootstrap's form example: Wrap labels and controls in .form-group for optimum spacing.

.inline-group {
display: inline-block;
}
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="container">
<hr>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Click To Open Modal
</button>
</div>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="form-group inline-group">
<a href="" id="button-parent" class="btn btn-default">Parent Folder</a>
</div>
<div class="form-group inline-group">
<a href="" id="button-refresh" class="btn btn-default">Refresh Page</a>
</div>
<div class="form-group inline-group">
<button type="button" id="button-upload" class="btn btn-primary">Upload</button>
</div>
<div class="form-group inline-group">
<button type="button" id="button-folder" class="btn btn-default">Create Folder</button>
</div>
<div class="form-group inline-group">
<button type="button" id="button-delete" class="btn btn-danger">Delete</button>
</div>
</div>
</div>

<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="input-group">
<input type="text" name="search" value="" placeholder="" class="form-control">
<span class="input-group-btn">
<button type="button" data-toggle="tooltip" title="<?php echo $button_search; ?>" id="button-search" class="btn btn-primary"><i class="fa fa-search"></i></button>
</span>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

但是,form-group是一个 block 属性,因此,它会删除新行中的每个表单元素,所以您可以添加另一个类,例如.inline-group 并使其display:inline-block 如图所示

关于twitter-bootstrap - Bootstrap modal-body 上的行没有间隙吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32966394/

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