I’m currently making a website and I am having trouble adjusting the width and height of some background images. So far, the only way I have been able to make it happen is by adding a **** load of padding to make it expand, but when I want to add content inside it, I get more trouble with the content going towards the middle. I tried adding width and height, but nothing happens.
I attached an image. It’s the 3 gray boxes towards the bottom.
I’m not really clear on what you are trying to achieve here. You can’t make background images expand, though. If you want the boxes to be bigger than the background image, you can set the image to repeat, so that it fills the box’s background.
Of course when you add padding it makes it impossible for the content to be near the outer edges, so it only has inwards to go :). I also have trouble seeing what you want. Could you screenshot another picture and modify it via pain or photoshop and show us what you actually want?
It’s highly probable we will need more code then just those HTML/CSS snippets.
I’ll try repeating the background. I’ll attach before and after pictures of what I’m trying to achieve. I’m trying to put 3 boxes near the bottom of the page
Before:
After (added padding)
With the padding, I can’t really put content in it because it pushes everything over (obviously) but right now I am using it to give an idea of how the background should look like. I need to get it to look like this without padding.
The hosting company (FatCow) seems to take forever to make any changes, so if you don’t see text in those boxes then you can high-lite it. You’ll see that it’s sort of in the middle due to all that padding.
cool, glad that helped. It might need some refining, but you get the basic idea. Generally I avoid setting heights on boxes, in case the content needs to expand, so there are some alternatives … but see how you go with this.
If you must set heights on boxes I would recommend setting the font size to ems and also setting the height of hte element to em. That way, at least, text resize won’t be an issue :).
Though as Ralph said you should avoid height setting on content altogether.
Unless you set a background image with no repeat or background color, in which case it’s MORE of a mess since it looks like the text is ‘blowing’ out of it’s container.
Really though this is why pages like this fall into the “But i can do it in photoshop” bin, as this is another of those “not viable for web deployment” concepts that have no real business on websites.
Well, unless you REALLY want it broken on anything other than the same magical combination of screen size and font renderer as the designer had.
I think the OP woul paint himself into a corner by continuing to follow that path. For starters , he’s created a fix dimension box, that doesn’t even seem to account for the fluidity of web content.
I would humbly suggest the following:
Break the box into 3 images
This makes the content boxes vertically fluid and keeps the fancy gradient and shadow. I f you want to adapt for OLD IE support, just gives the DIVs classes instead of using the child selector and add:
.test li { zoom:expression(
runtimeStyle.zoom=1,
insertAdjacentHTML('beforeEnd','<span class="after"></span>')
);
Also the sum total of the image load goes WAY down since you don’t have a LARGE PNG.