开发者

How to center a user's view using javascript

I have a webpage with a background image that extends (in some resolutions) beyond the width of the browser's window.

The contents of the webpage in question are centered, relative to the background image, and so I would like that the visitors to the webpage would have their view horizontally centered aswell.

Is that possible? If not, how would I 开发者_如何学Gogo with dynamically cropping the background image, to fit the window size of the viewer?


Modify the css:

Goto the body{} class and modify it as:

body
{
background: url('path-to-ur-image/image.jpg') top no-repeat;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜