問題:
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