【发布时间】:2021-07-21 19:48:34
【问题描述】:
我在文本下得到了一张图片,并且总是希望它在文本下方居中。
<div>
<div>
<div style="color: black;margin-top: 20px;"> Long text where i want a picture beneath with a <a href="https://crop-circle.imageonline.co/crop-circle.png" style="color:black;" target="_blank">Flower</a> </div>
<a href="https://www.asd.de/">
<div> <img class="img-responsive" src="https://crop-circle.imageonline.co/crop-circle.png" target="_blank" style="padding-top:2px;height:auto;max-width: 170px;"> </div>
</a>
</div>
</div>
已经尝试过 display:block、inline-block、不同大小的网格等。
这就是我要找的:
this is a long text and i want the picture to be centerd
__________________
| |
| Picture |
| |
▔▔▔▔▔▔▔▔▔▔▔
【问题讨论】:
-
这能回答你的问题吗? Center image element in parent div
-
display:inline-block 到父 div + text-align:center