gpt4 book ai didi

css - 带有垂直中间字符/图标的 Bootstrap 面板标题

转载 作者:太空宇宙 更新时间:2023-11-04 09:02:02 25 4
gpt4 key购买 nike

在小型设备(< 600px 宽度)上显示时,如何使 x 位于垂直中间?

<div class="row">
<div class="col-sm-12">
<section class="panel panel-default panel-slider"><div class="panel-heading">
<h1 class="panel-title" style="font-size:18px">
Test with long description in title panel bla bla<a class="align-middle more pull-right" href="https://example.com" title="" data-toggle="tooltip" data-placement="right" data-original-title="more" ><i>x</i></a>
</h1>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-8" style="margin-bottom: 10px;">
...
</div>
</div>

目前是:

enter image description here

应该是:

enter image description here

https://jsfiddle.net/9dtu4en1/

提前致谢!

亲切的问候亚历克斯

最佳答案

我会在 h1 上使用 flexbox 以更流畅地调整大小,并删除 align-middlepull-right(以避免a:

中的 float ,这会使它的 parent 不考虑 child 的高度)

External Fiddle to resize

enter image description here

enter image description here

enter image description here

片段:

h1 {
display: flex;
justify-content: space-between;
align-items: center;
}
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="row">
<div class="col-sm-12">
<section class="panel panel-default panel-slider">
<div class="panel-heading">
<h1 class="panel-title" style="font-size:18px">Test with long description in title panel bla bla
<a class="more" href="https://example.com" title="" data-toggle="tooltip" data-placement="right" data-original-title="more"><i>x</i></a>
</h1>
</div>
<div class="panel-body">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-8" style="margin-bottom: 10px;">
...
</div>
</div>

关于css - 带有垂直中间字符/图标的 Bootstrap 面板标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42704380/

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