今のところ、画像を水平方向に中央揃えにすることはできますが、垂直方向に中央揃えにしようとすると(上マージンを追加)、親divも下に移動します(これは望ましくありません)。
これが私が話していることの画像です:スクリーンショット
絶対位置に設定するのが最善の方法だと思いますが、水平方向の中央に配置するのに問題があります。
<div id="header">
<div id="container">
<div id="logo">
<a href="index.html"><img src="images/logo.png" /></a>
</div>
</div>
</div>
#container {
width: 960px;
margin: 0 auto;
position: relative;
}
#logo {
height: 96px;
width: 484px;
margin: 50px auto;
}
助けていただければ幸いです!ありがとうございました