我正在尝试将图像置于div中,我使用了显示器:table& display:table-cell方法。它居中但距离顶部几个像素。我该怎么做才能纠正这个问题?
CSS
html, body {
width: 100%;
height: 100%;
}
body,html {
margin: 0;
padding: 0;
color:#ffffff;
text-align: center;
}
#wrapper{
text-align: left;
width: 940px;
margin: 0 auto;
margin-top: 22px;
background-color: #ffffff;
overflow: hidden;
}
header {
width: 908px;
height: 76px;
display: table;
border-style:solid;
border-top-width: 16px;
border-bottom-width: 16px;
border-top-color: #ffffff;
background-color: #cccccc;
}
#headerdiv { display: table-cell; vertical-align: middle; margin: 0; height: 28px; }
HTML
<div id="wrapper">
<header>
<div id="headerdiv"><img src="logotest.gif" height="28" width="180" alt="test"></div>
</header>
</div>