【发布时间】:2021-08-17 14:05:03
【问题描述】:
这就是我想要的(带着包)https://i.stack.imgur.com/iUh9O.png
这就是我现在拥有的https://i.stack.imgur.com/f1GhW.png
这是css:
<!--listing-->
.listing{}
.listing{
display:inline-block;
margin-top:150px;
margin-left:60px;
width:35%;
}
.listing p {
font-size:16px;
line-height:30px;
color:#0000;
}
.price {
color: #f76f46;
font-size:20px;
font-weight:100px;
}
和html:
<!--main section-->
<div class="listing">
<img src="pinkbag.png" class="center">
<p style="color:#3d5791;" class="center"><b>Extra Large Madison Handbag</b><br><span class="price center">$76.00</span></p>
<img src="pinkbag.png" class="center">
<p style="color:#3d5791;" class="center"><b>Extra Large Madison Handbag</b><br><span class="price center">$76.00</span></p>
<img src="pinkbag.png" class="center">
<p style="color:#3d5791;" class="center"><b>Extra Large Madison Handbag</b><br><span class="price center">$76.00</span></p>
</div>
如果我使用 display:inline-flex;而不是 css 中的 inline-block ,而是这样结束 https://i.stack.imgur.com/O65l2.png
有没有办法让文字留在每张图片下方?
【问题讨论】:
-
您需要为 img + p 添加一个包装器,这样您就可以将 flex-direction 更改为它们的列,并且文本将位于图像下方