问题:
I have a div 200 x 200 px.我有一个 200 x 200 像素的 div。 I want to place a 50 x 50 px image right in the middle of the div.我想在 div 的中间放置一个 50 x 50 px 的图像。
How can it be done?怎么做?
I am able to get it centered horizontally by using text-align: center
for the div.我可以使用text-align: center
使其水平居中。 But vertical alignment is the issue..但垂直对齐是问题。
解决方案:
参考一: https://en.stackoom.com/question/1cyy参考二: https://stackoom.com/question/1cyy