开发者

resizable backgrounds

开发者 https://www.devze.com 2023-01-22 13:44 出处:网络
ok i need to make a whole background image so t开发者_JAVA百科hat it resizes with the window and keeps the same proportions

ok i need to make a whole background image so t开发者_JAVA百科hat it resizes with the window and keeps the same proportions

i need to do this only using css

does anybody know how i have looked but cannot find a working solution. i tried some suggestions on here too but does not seem to work for me either

thankyou


You might want to read the article "Supersize that Background, Please!" on A List Apart. It presents "old" as well as modern techniques.

In order to do it in vanilla CSS, you cannot settle for less than CSS3 since both Background and Borders and Media Queries modules are required.


What you are asking for is not possible. Not with standard CSS2.0 and XHTML.

You can make an image tile, but not scale to fit your page.

The link you provided does just that, it repeats the image in a tile fashion. Background images do this by default.


Sorry, CSS can't stretch images. Only an <img> tag can do that. So you'll have to put one of those in the background.

Maybe you can do that with CSS3, I don't know, but even then browser support is not very good yet.


Here is an example of using a div (100% width + height) containing an img tag to use as the background, might be worth a look.


Try this technique: http://css-tricks.com/perfect-full-page-background-image/

0

精彩评论

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