开发者

how can you set the top and left of a background image in css

i am looking at a page whic开发者_运维技巧h has an image on it. i see that in the css, the image is set as a background but the image is not at the top of the page. So my basic questions is trying to understand the css below

#p_background {
    background:url(/Content/images/test.gif) no-repeat center 108px;
}

in particular, what does the center and 108px represent?


It is a short form of:

#p_background {
    background-image:url(/Content/images/test.gif);
    background-repeat: no-repeat;
    background-position: center 108px;
}

See http://www.w3schools.com/css/css_background.asp and http://www.w3schools.com/cssref/pr_background-position.asp


What you are seeing is the 'shorthand' code specifying the properties of the background of that div. It could be expressed this way:

background-image:url('/Content/images/test.gif');
background-repeat:no-repeat;
background-position:108px;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜