开发者

How place background-image to the top of the div with padding

In Html I've this code

<div class="page">
        <div id="header">
            ...
        </div>
</div>

And here is my css

.page {
    width: 1028px;
    background-color:#103250;
    margin-left: auto;
    margin-right: auto;
}

#header
{
    background:url开发者_如何学Python('/Img/SubpageBox1.png') no-repeat top;
    height:150px;
    padding-top:50px;
}

But now my background-image is placed out of div... On the top of the page... How can I place it on the top of the header?


You can specify the position of the background image:

background:url('/Img/SubpageBox1.png') no-repeat center 50px;

or using background-position css property.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜