Bootstrap 折叠面板使用折叠图标而不是标题时存在视觉问题
Bootstrap collapse panel has visual problems using a collapse icon instated of heading
我正在使用一些可折叠的 bootstrap 面板,并通过点击 header 作为 the example 进入折叠状态,我在 [=25] 的右侧有一个图标=] 触发崩溃。正如您在 jsfiddle 中看到的那样,折叠过渡在执行此操作时会出现视觉问题。它将所有 panel-body 内容缩小到图标所在的位置。有关简化示例,请参阅 JSFiddle。
https://jsfiddle.net/10bLdb5t/3/
谢谢!
HTML:
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<div class="panel-group">
<div class="panel panel-default" id="panel1">
<div class="panel-heading">
<a class="btn btn-collapse pull-right" data-toggle="collapse" href="#collapseOne">
<i class="fa fa-caret-square-o-up"></i>
</a>
<h4 class="panel-title">
Collapsible Group Item #1
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
如果添加此样式规则
style="margin-top:-8px;"
到你的 a
标签,你的问题就解决了。不知道这是否是最佳解决方案,但它确实有效。
我正在使用一些可折叠的 bootstrap 面板,并通过点击 header 作为 the example 进入折叠状态,我在 [=25] 的右侧有一个图标=] 触发崩溃。正如您在 jsfiddle 中看到的那样,折叠过渡在执行此操作时会出现视觉问题。它将所有 panel-body 内容缩小到图标所在的位置。有关简化示例,请参阅 JSFiddle。
https://jsfiddle.net/10bLdb5t/3/
谢谢!
HTML:
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<div class="panel-group">
<div class="panel panel-default" id="panel1">
<div class="panel-heading">
<a class="btn btn-collapse pull-right" data-toggle="collapse" href="#collapseOne">
<i class="fa fa-caret-square-o-up"></i>
</a>
<h4 class="panel-title">
Collapsible Group Item #1
</h4>
</div>
<div id="collapseOne" class="panel-collapse collapse in">
<div class="panel-body">
Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
</div>
</div>
</div>
</div>
如果添加此样式规则
style="margin-top:-8px;"
a
标签,你的问题就解决了。不知道这是否是最佳解决方案,但它确实有效。