- Last post
- 3 Responses
I have background image I would like to be able to manually change the height of obviously without having to resize the image itself in photoshop. Below is the code.
Is this possible? I tried putting ,height:###px after the no repeat but it doesnt work.
nope, background-scaling is not possible, the only way to do it would be to put an img inside the element you want to scale and give it 100% width (or height/both) and then it will inherit the size of the parent-element:
<div style="width: 100px;">
<img src="a.jpg" style="width: 100%;" />
so then the <img> would be 100px wide and the height will be scaled proportionally
when you use overflow:hidden; and max-width on the <div> you can make sure that the <img> won't blow it up.
You want to have a filled and resized background, won't you? ;) if that's the case you have to do a little more to get that working 100% correctly..
- Background-size works just fine in css3. You are incorrect.orrinward2
- The sizes "contain" and "cover" are options for making the BG fill the container without stretching.orrinward2
- "contain" scales the image to fit entirely within the container with no cropping,orrinward2
- "cover" scales it to fill, with cropping.orrinward2
- lol css3 good luckmekk