I'm having trouble with centering images that are inside <a>
tag. To center all of them horizontally, I set justify-content: center;
to <span>
container that contains mentioned images.
Then I set align-self: center;
for both <a>
and <img>
elements, it works just perfect in Chrome and Firefox browsers, but in IE I'm not able to center images vertically.
And important is that I cannot change the flow of the elements, I mean that <span>
must contain <a>
and it contains <img>
.
You can find an example on created there -> fiddle内垂直和水平居中的问题。
答案 0 :(得分:1)
img元素可以使用text-align:center;我知道很奇怪。
答案 1 :(得分:1)
你走了:
<强> CSS 强>
.multiimage {
background-color: black;
text-align: center;
display: block;
padding: 50px 0px;
}
.multiimage a img {
width: 90px;
height: 90px;
display: inline-block;
}