无法弄清楚为什么我的图像没有对齐中心(wordpress)

时间:2017-04-11 00:01:17

标签: css wordpress

这是网站:http://www.whattheyuse.net/alivecor-kardia-mobile-ecg-review/

它们以wordpress和css为中心对齐,我不明白它们为什么不显示居中(当宽度足够大时)。

编辑:我能够解决它,问题是我有宽度:75%并且对齐中心。我刚刚删除了75%的宽度。

2 个答案:

答案 0 :(得分:2)

在你的CSS中你有这段代码:

@media screen and (min-width: 768px)
img.size-big, .wp-caption.caption-big {
    display: inline-block;
    float: none;
    margin-left: -60px;
    margin-bottom: 1.7778em;
    max-width: 780px;
}

删除此:

display: inline-block;
margin-left: -60px;

答案 1 :(得分:2)

在图片周围的段落标记中,只需将其样式设置为text-align: center

<p style="text-align: center"><a href="https://www.amazon.com/exec/obidos/ASIN/B01A4W8AUK/whattheyuse-20/" target="_blank"><img class="size-full wp-image-1536 aligncenter size-big" src="http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1.jpg" alt="" width="75%" height="auto" srcset="http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1.jpg 2189w, http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1-300x281.jpg 300w, http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1-768x720.jpg 768w, http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1-1024x959.jpg 1024w, http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1-660x618.jpg 660w" sizes="(max-width: 2189px) 100vw, 2189px"></a></p>

(无)

<p><a href="https://www.amazon.com/exec/obidos/ASIN/B01A4W8AUK/whattheyuse-20/" target="_blank"><img class="size-full wp-image-1536 aligncenter size-big" src="http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1.jpg" alt="" width="75%" height="auto" srcset="http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1.jpg 2189w, http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1-300x281.jpg 300w, http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1-768x720.jpg 768w, http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1-1024x959.jpg 1024w, http://www.whattheyuse.net/wp-content/uploads/2017/04/Kardia1-660x618.jpg 660w" sizes="(max-width: 2189px) 100vw, 2189px"></a></p>