简体   繁体   English

调整背景图像以适应

[英]Background image resizing to fit

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. 我会根据需要尝试CSS甚至Javascript(JQuery)解决方案。

I guess you're looking for something like that: 我想你正在寻找类似的东西:

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

You will need to stick to CSS 3 background-size property to achieve this: http://webdesign.about.com/od/styleproperties/p/blspbgsize.htm 您将需要坚持使用CSS 3 background-size属性来实现此目的: http//webdesign.about.com/od/styleproperties/p/blspbgsize.htm
Without using CSS 3 you cannot resize the background image in any way on the client. 如果不使用CSS 3,则无法以任何方式在客户端上调整背景图像的大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM