本文翻译自:Center image horizontally within a div
This is probably a stupid question but since the usual ways of center aligning an image are not working I thought I would ask. 这可能是一个愚蠢的问题,但是由于居中对齐图像的常规方法不起作用,所以我想问一下。 How can I center align (horizontally) an image inside its container div? 如何在容器div内居中对齐(水平)图像?
Here's the HTML and CSS. 这是HTML和CSS。 I've also included the CSS for the other elements of the thumbnail. 我还包括了缩略图其他元素的CSS。 It runs in descending order so the highest element is the container of everything and the lowest is inside everything. 它以降序运行,因此最高的元素是所有内容的容器,最低的元素是所有内容的容器。
#thumbnailwrapper { color: #2A2A2A; margin-right: 5px;