gpt4 book ai didi

html - 在移动设备上将面板标题中的跨度分隔为两行

转载 作者:太空宇宙 更新时间:2023-11-04 15:50:37 26 4
gpt4 key购买 nike

我有一个面板,面板标题如下所示,我想弄清楚如何让它在移动设备上分成两行<480px,在大于 480px 时分成一行

<div class="panel panel-default" style="border: 1px solid lightgrey;">
<div class="panel-heading" style="text-align: center; font-size: 1.2em; color: #777;">
<span>panel heading text</span><span> more text</span>
</div>
<div>
</div>
</div>

最佳答案

你需要mediaqueries ,

Media queries are useful when you want to modify your site or app depending on a device's general type (such as print vs. screen) or specific characteristics and parameters (such as screen resolution or browser viewport width).

基本代码可以是:

@media (max-width: 480px) {
span {
display: block;
}
}

演示:

@media (max-width: 480px) {
span {
display: block;
}
}
<div class="panel panel-default" style="border: 1px solid lightgrey;">
<div class="panel-heading" style="text-align: center; font-size: 1.2em; color: #777;">
<span>panel heading text</span><span> more text</span>
</div>
<div>
</div>
</div>

关于html - 在移动设备上将面板标题中的跨度分隔为两行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50664478/

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