Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > set div width to remaining width of the browser

Reply
Thread Tools

set div width to remaining width of the browser

 
 
Steve Richter
Guest
Posts: n/a
 
      06-15-2007
using float: left and float: right to build a two column page
layout.
<div style="float:left">column 1</div>
<div style="float:right">column 2</div>

then I set the width of the first column to a fixed size:
<div style="float:left; width:10em;>column 1</div>

how can I set the width of the 2nd column, the float:right div, to
fill the remaining space of its container?

I know I can use percentages, but I want the left column to always be
the same fixed length.

Is this a case where <table> is the obvious solution?

thanks,

-Steve

 
Reply With Quote
 
 
 
 
Yuriy Solodkyy
Guest
Posts: n/a
 
      06-15-2007
Do you need this?

<div style="float:left; width: 10em; border: solid 1px red">
ZZZZZ
</div>
<div style="margin-left: 10em; border: solid 1px green">
www
<div>


> using float: left and float: right to build a two column page
> layout.
> <div style="float:left">column 1</div>
> <div style="float:right">column 2</div>
> then I set the width of the first column to a fixed size: <div
> style="float:left; width:10em;>column 1</div>
>
> how can I set the width of the 2nd column, the float:right div, to
> fill the remaining space of its container?
>
> I know I can use percentages, but I want the left column to always be
> the same fixed length.
>
> Is this a case where <table> is the obvious solution?
>
> thanks,
>
> -Steve
>



 
Reply With Quote
 
 
 
 
Steve Richter
Guest
Posts: n/a
 
      06-15-2007
On Jun 15, 2:00 pm, Yuriy Solodkyy <(E-Mail Removed)> wrote:
> Do you need this?
>
> <div style="float:left; width: 10em; border: solid 1px red">
> ZZZZZ
> </div>
> <div style="margin-left: 10em; border: solid 1px green">
> www
> <div>
>


thank you. I just read of the margin technique in a very good book I
have:
http://www.amazon.com/CSS-Anthology-...1932373&sr=8-1

a lot of CSS positioning seems to be a hack. esp if you dont want to
use javascript out of concern of complicating things even further.

I assume CSS does not allow one div to reference another for is
position and size? That would seem to be ideal for page layouts.
( where the height of div a is always the height of div b, div c
always has the same absolute X position of div d, ... )

thanks,

-Steve



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<div ... /> and <div ...></div> K Viltersten ASP .Net 4 03-31-2009 07:33 PM
remaining width ewosch Javascript 1 11-15-2006 02:06 PM
how to: div width = browser.width? =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 3 10-30-2006 05:43 AM
how to set table's first column to be static and remaining can be scrolled through CSS balakrishnan.dinesh@gmail.com Javascript 4 08-17-2006 02:59 PM
Q: Div A inside Div B is larger than Div B Dwayne Madsen Javascript 1 06-01-2005 03:02 PM



Advertisments