最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Background image resizing to fit - Stack Overflow

programmeradmin1浏览0评论

I'm trying to make the background image as professional as possible so I'm thinking it's best to resize it based on the size of the browser or the resolution (not sure what's usually used, but I think browser size makes sense here). The idea is if the viewer screen is small, the background image gets smaller, and as the screen gets bigger, the image expands to fit its maximum size.

I will try a CSS or even Javascript (JQuery) solution as needed.

I'm trying to make the background image as professional as possible so I'm thinking it's best to resize it based on the size of the browser or the resolution (not sure what's usually used, but I think browser size makes sense here). The idea is if the viewer screen is small, the background image gets smaller, and as the screen gets bigger, the image expands to fit its maximum size.

I will try a CSS or even Javascript (JQuery) solution as needed.

Share Improve this question asked Sep 26, 2010 at 23:49 vlavla 2891 gold badge3 silver badges6 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

You will need to stick to CSS 3 background-size property to achieve this: http://webdesign.about./od/styleproperties/p/blspbgsize.htm
Without using CSS 3 you cannot resize the background image in any way on the client.

I guess you're looking for something like that:

http://css-tricks./how-to-resizeable-background-image/

发布评论

评论列表(0)

  1. 暂无评论