Page 1 of 1

Change the size of a background image to fit the DIV element

Posted: Fri Apr 16, 2004 11:31 am
by Chris Corbyn
Hi,

I've designed a simple background image to use as a backing for all my chunks of text etc by putting text in a DIV element with a backround image.

I was wondering if, since I will use the image over and over in various sized (though similarly sized) DIV elements there is a way to add some height and width attributes to the image?
The code I'm using at present is:

Code: Select all

<div align=center style="background-image: url(backing.gif); height: 400px; width: 330px;">
Even better if the image would dynamically change size onload.

Thanks :-)

Posted: Fri Apr 16, 2004 11:39 am
by kendall
d11wtq,

I don't think so man...i think however that you should make the image a certin size aspect.

I do things like that all the time...i make my background images in such a way that no matter what size it is it conforms and doesnt look as though it is repeating even doe it does!

Kendall

Posted: Fri Apr 16, 2004 11:55 am
by Chris Corbyn
Yeah i see how you mean.

My all my image is just one big solid block of color in a rectagular shape with smooth rounded corners. I need the corners to only appear at corners so I could perhaps chop my corners out and stick everything in a little table with the corner cells containing the bit for the corners and all else containing just a background color which is identical to the image color. My page would load faster too I guess. Is that the normal way to do things like that?

Posted: Fri Apr 16, 2004 12:14 pm
by Chris Corbyn
Yeah I've sorted it out by chopping up and using tables. Looks sweet

Posted: Fri Apr 16, 2004 1:48 pm
by kendall
kENDALL,

YEAH THAT WORKS TOO LOL