gpt4 book ai didi

html - 媒体查询 - 堆叠内容

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

这是对我当天早些时候提出的问题的跟进。当屏幕尺寸 < 350px 时,我现在正在尝试使用媒体查询来堆叠内容。我试图将其堆叠为图像(居中对齐),然后是下一行中的文本(居中对齐)。我一直在尝试各种组合,但我一直无法得到它。非常感谢任何帮助。

<div class="freedom_carousel">
<!--Freedom section -->
<p class="heading">This is heading.</p>
<div class="container1">
<div class="col1">
<p>
<img class="icon" src="/path/to/image" /> <span class="icon-text"> <b>This is </b> Text TextText TextText TextText TextText Text </span>
</p>
</div>
<div class="col2">
<p>
<img class="icon" src="/path/to/image" /> <span class="icon-text"> <b>This is </b> Text TextText TextText TextText TextText Text </span>
</p>
</div>
</div>
<!--End of container 1 -->
<div class="container2">
<div class="col1">
<p>
<img class="icon" src="/path/to/image" /> <span class="icon-text"> <b>This is </b> Text TextText TextText TextText TextText Text </span>
</p>
</div>
<div class="col2">
<p>
<img class="icon" src="/path/to/image" /> <span class="icon-text"> <b>This is </b> Text TextText TextText TextText TextText Text </span>
</p>
</div>
</div>
<!--End of container 2 -->
</div>
</div>
<!--End of Freedom carousel -->

完整代码的 JSfiddle:http://jsfiddle.net/0cr1zj89/1/

最佳答案

将其添加到堆栈列。

@media screen and (max-width: 350px) { 
.freedom_carousel .col1,
.freedom_carousel .col2 {
float: none;
width: 100%;
margin: 0px;
}
}

关于html - 媒体查询 - 堆叠内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25495671/

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