...

View Full Version : <div> CSS box problem



dj05
10-04-2007, 12:00 AM
Hi

I'm new to using <div> and css to create a layout for a site, im used to using <table> and css.

My question is thus. On the following site i have a box which will go around any message or form on my site. The problem is that the box covers the entire width of the page and i only want it to wrap around its contents, (IE the login form on the example page below) i just can't figure out how to do it.

The site is...
http://www.thecoldwars.com/flytrap/

TIA

bDare
10-04-2007, 12:50 AM
Are you talking about the div with the id "container" or the div with the id "box"?

Either way, to edit the width you can do something like this:



#container{
width: 200px;
}

or



#container{
width: 50%;
}

All you need to do is define the width. You can define the width by using pixels (px), percentages (50%), etc.

_Aerospace_Eng_
10-04-2007, 01:21 AM
You then need to float the element if you want other <div></div> elements to be next to it.

dj05
10-04-2007, 09:44 AM
My bad, should have gone into a bit more detail.

The problem <div> is the one with the ID 'box'. I want it to automatically fit around whatever is in the <div> i can't use a fixed width because the contents could be bigger or smaller on different pages.

Thanks for your help



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum