我相信有一个CSS Utility attribute,你可以使用称为text-center
。将其应用于包裹图像的div。 div上的text-center
会解析为CSS
div {text-align:center!important;如果您的标记中有很多,请使用类或ID对其进行样式设置。
您可能还想对图像应用类似的东西来设置它的样式..
#imgwrap {
min-width:200px;
min-height:150px;
background-color:blue;
text-align: center!important;
img {
border:0;
max-width:140px;
border-radius:50%;
}
}
<div class"split-pane">
<div id="imgwrap">
<img src="http://via.placeholder.com/150x150">
</div>
</div>
如果你想进入issues with border radius and images,CSS Tricks有一些内容。