开发者

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

开发者 https://www.devze.com 2023-04-10 09:53 出处:网络
In Html I\'ve this code <div class=\"page\"> <div id=\"header\"> ... </div> </div>

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

精彩评论

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