如何在标题中垂直居中背景图像

时间:2013-05-11 02:23:10

标签: css vertical-alignment

CSS

#container  {
width: 1000px;
margin: 0 auto;
background-color: #000000;
}

#header {
width: 884px;
height: 300px;
position: relative;
margin: auto;
background-image: url(babygoatbooksbanner.png); text-align:center;
background-repeat: no-repeat;
}

HTML

<body>
<div id="container">
<div id="header"></div>
<div id="headertoo"></div>
<div id="leftnav"> dude wheres my car</div>
<div id="body"></div>
</div>
</body>

1 个答案:

答案 0 :(得分:1)

您的意思是background-image吗?

试试这个:

background: url(babygoatbooksbanner.png) scroll no-repeat center transparent;