gpt4 book ai didi

javascript - 怎么把这3张图放在左边,3张放在右边呢?

转载 作者:搜寻专家 更新时间:2023-11-01 00:35:38 25 4
gpt4 key购买 nike

我连续有 6 张图片,我想将 3 张放在左边,3 张放在右边。我尝试了 display: flex 和 float:left 但是它只是将部分选项卡下方的所有内容向上重叠显示。如何将 6 张图片分成两半,并在中间放置文字?

<section className="open-text">
<h1>
<br/>
<img className="move_to_left" height="70" width="70" alt="usda_icon" src= "images/FDAT.gif"/>
<img className="move_to_left" height="70" width="70" alt="usda_icon" src= "images/usdaT.gif"/>
<img className="move_to_left" height="80" width="80" alt="usda_icon" src= "images/dermT.png"/>
***String of Text***
<img className="move_to_right" height="90" width="90" alt="usda_icon" src= "images/HypoT2.jpg"/>
<img className="move_to_right" height="100" width="100" alt="usda_icon" src= "images/ssl.png"/>
<img className="move_to_right" height="80" width="80" alt="usda_icon" src= "images/para2.gif"/>
<br/>
</h1>
</section>

CSS

.open-text > h1 {
color: #1e3a87;
border-top: 1px solid white;
margin-top: 12.5px !important;
height: 10rem;
display: flex !important;
align-items: center !important;
mix-blend-mode: color-burn;
display: flex !important;
align-items: center !important;
font-family: 'Cinzel Decorative', cursive;
}
.open-text > h1 {
/*border: 4px solid red;*/
/*display: flex;*/
/*justify-content: space-around;*/
/*float: left;*/
}
.open-text > h1:nth-child(odd) {
border: 1px solid red;
/*float: right;*/
}

最佳答案

在 html 中使用 class=""作为类名

这可以使用 flexbox 来完成,方法是让父级对齐中心元素,然后将每个元素设置为在 flex box 内相应地 float ,align-self : start for the left ones, and align-self:end;为正确的。

这是我将如何完成的示例:

.open-text {
display:flex;
align-items:center;
justify-content:space-around;
}
.open-text h1 {
color: #1e3a87;
display: flex;
align-items: center;
font-family: 'Cinzel Decorative', cursive;
justify-content:space-around;
}
.open-text img {
margin:5px;
}
.open-text .move_to_left {
align-self:start;
}
.open-text .move_to_right {
align-self:end;
}
.open-text .string_of_text {
align-self:center;
}
<section class="open-text">
<h1>
<br/>
<img class="move_to_left" height="70" width="70" alt="usda_icon" src= "https://via.placeholder.com/70"/>
<img class="move_to_left" height="70" width="70" alt="usda_icon" src= "https://via.placeholder.com/70"/>
<img class="move_to_left" height="70" width="70" alt="usda_icon" src= "https://via.placeholder.com/70"/>
<span class="string_of_text">***String of Text***</span>
<img class="move_to_right" height="70" width="70" alt="usda_icon" src= "https://via.placeholder.com/70"/>
<img class="move_to_right" height="70" width="70" alt="usda_icon" src= "https://via.placeholder.com/70"/>
<img class="move_to_right" height="70" width="70" alt="usda_icon" src= "https://via.placeholder.com/70"/>
<br/>
</h1>
</section>

关于javascript - 怎么把这3张图放在左边,3张放在右边呢?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53093662/

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