Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-03-2007, 11:00 PM   PM User | #1
dj05
New to the CF scene

 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
dj05 is an unknown quantity at this point
<div> CSS box problem

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
dj05 is offline   Reply With Quote
Old 10-03-2007, 11:50 PM   PM User | #2
bDare
New Coder

 
Join Date: Sep 2007
Posts: 24
Thanks: 4
Thanked 1 Time in 1 Post
bDare is an unknown quantity at this point
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:

Code:
#container{
width: 200px;
}
or

Code:
#container{
width: 50%;
}
All you need to do is define the width. You can define the width by using pixels (px), percentages (50%), etc.
bDare is offline   Reply With Quote
Old 10-04-2007, 12:21 AM   PM User | #3
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
You then need to float the element if you want other <div></div> elements to be next to it.
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 10-04-2007, 08:44 AM   PM User | #4
dj05
New to the CF scene

 
Join Date: Oct 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
dj05 is an unknown quantity at this point
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
dj05 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:17 PM.


Advertisement
Log in to turn off these ads.