html css background script
- Started
- Last post
- 11 Responses
- jsaul
Hey,
Anyone know of a good script for scaling a css background image (ala fullscreen flash) but with html+css, the solutions I have seen use an img element, Id like to do it with a background in my css if possible ?
Can it be done ?
- airey0
note that the above example is css3 only. the following browsers support some css3 setups:
- jsaul0
thanks for those, will be trying it out
- db_gd0
http://www.crushed.co.uk/ seems to have it sussed.
- jamble0
Crushed uses an image in the html, not the css. It's perfectly do-able if you put the image in the HTML as you can just apply a width and height of 100% in the css to an img class but you can't do it in CSS using a background.
An example of how it's done is here: http://www.cssplay.co.uk/layouts…
- Nathan_Adams0
I had a similar technique to Crushed going on a site I had in development for a client, but ultimately got vetoed because my boss insisted on viewing it on one of those retarded micro laptops, that had a semi normal screen width, but pratically no vertical height - hence stretching the background in a way you'd rarely see.
I do remember after all that seeing a script that kept it all in proportion, whilst still filling the browser window. I'll see if I can dig it up.
- Nathan_Adams0
Have a look at this:
http://css-tricks.com/how-to-res…
- neverblink0
that last one doesn't really work.. they need to switch from width = 100% to height = 100% when the viewport's width is smaller than the height.
- pylon0
Agreed, neverblink.
I'll likely need to be done via javascript or similar as that's a calculation that I don't believe can be done via CSS. There has to be logic built in that takes into account window height and window width and then scales the image along the appropriate axis.
- jsaul0
thanks everyone, gone with the crushed method, great help, cheers !