无法将帖子图像放到中心

问题描述 投票:0回答:1

我正在此网站上工作:https://www.thewellnessproject.net/how-you-eat-is-how-you-live-the-7-types-of-eaters/

<div class="wp-block-image"><figure class="aligncenter size-large is-resized"><img src="https://www.thewellnessproject.net/wp-content/uploads/2020/06/eat-how-you-live-PT-683x1024.png" alt="" class="wp-image-3048" width="550" srcset="https://www.thewellnessproject.net/wp-content/uploads/2020/06/eat-how-you-live-PT-683x1024.png 683w, https://www.thewellnessproject.net/wp-content/uploads/2020/06/eat-how-you-live-PT-200x300.png 200w, https://www.thewellnessproject.net/wp-content/uploads/2020/06/eat-how-you-live-PT-768x1152.png 768w, https://www.thewellnessproject.net/wp-content/uploads/2020/06/eat-how-you-live-PT-585x878.png 585w, https://www.thewellnessproject.net/wp-content/uploads/2020/06/eat-how-you-live-PT.png 900w" sizes="(max-width: 683px) 100vw, 683px" /></figure></div>

如您所见,帖子图像(页面下方大约四分之一)将不会居中。我将图像设置为从写文章页面居中。我也加入了代码,例如:

.post-content img {
	margin-top: 15px;
    margin: 0 auto;
}

.wp-block-image {
	text-align: center !important;
}

.aligncenter {
	text-align: center !important;
}

似乎没有任何作用。非常感谢您的投入。预先感谢。

wordpress
1个回答
0
投票
这应该做:

.aligncenter { text-align: center; display: block !important; }

您需要删除或覆盖display: table;类上的.aligncenter
© www.soinside.com 2019 - 2024. All rights reserved.