Jump to content

Problem splitting DIV into 2 columns


Eiolon

Recommended Posts

I have a DIV that I split into two columns.

 

Left column has a fixed width of 500px.

Right column needs to expand 100% to fill the screen regardless of resolution.

 

What is happening is the right column is aligning itself to the right and there is tons of space in the middle.

 

If I tell the right column to be 100% it drops the column below the left column.

 

Attached is a screenshot of what is happening and what I am trying to do.

 

My code:

 

CSS

 


#wrapper {
border: 1px solid #000000;
}

#left {
width:500px;
float:left;
border: 1px solid #000000;


}

#right {
float:right;
border: 1px solid #000000;
width: 100%;

}

 

HTML

 

<div id="wrapper">
<div id="left">

<div class="program">
<label for="name">Name</label>
<input class="textbox" type="text" name="name" id="name" maxlength="100" title="What is the name of the program?" value="" />
</div>
<div class="program">
<label for="start">Date & Time</label>
<input class="textbox" type="text" name="start" id="start" maxlength="100" title="What date and time does it occur?" value="" />
</div>
<div class="program">
<label for="location">Location</label>
<input class="textbox" type="text" name="location" id="location" maxlength="100" title="Where is the program being held?" value="" />
</div>
<div class="program">
<label for="coordinator">Coordinator</label>
<input class="textbox" type="text" name="coordinator" id="coordinator" maxlength="100" title="Who is creating this program?" value="" />
</div>
<div class="program">
<label for="seats">Seats</label>
<input class="textbox" type="text" name="seats" id="seats" maxlength="3" title="How many seats are available?" value="" />
</div>

</div>
<div id="right">

<div class="program">
<label for="name">Name</label>
<input class="textbox" type="text" name="name" id="name" maxlength="100" title="What is the name of the program?" value="" />
</div>
<div class="program">
<label for="start">Date & Time</label>
<input class="textbox" type="text" name="start" id="start" maxlength="100" title="What date and time does it occur?" value="" />
</div>
<div class="program">
<label for="start">Date & Time</label>
<input class="textbox" type="text" name="start" id="start" maxlength="100" title="What date and time does it occur?" value="" />
</div>

</div>
</div>

 

[attachment deleted by admin]

Link to comment
Share on other sites

The trick I used was to give fixed width and float:left to the left DIV and no floating and no width to the DIV in the right. The right div aligns by itself on the left and takes the entire space(100%).

 

Hope this works for you too!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.