473,385 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

set div width to remaining width of the browser

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 <tableis the obvious solution?

thanks,

-Steve

Jun 15 '07 #1
2 6749
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 <tableis the obvious solution?

thanks,

-Steve

Jun 15 '07 #2
On Jun 15, 2:00 pm, Yuriy Solodkyy <y.dot.solod...@gmail.comwrote:
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

Jun 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

157
by: Dennis | last post by:
Is there some way --using, say, DOM or javascript-- to detect the current pixel width and/or height of a relatively sized table or of one of its columns or rows. I'm going to be writing javascript...
6
by: Timothy Madden | last post by:
Hello Please take a look at this table: http://web.ss.pub.ro/~bat/HelloWorld.php Now the table has the width property set to 100%, which should mean the width available to the browser. Does...
18
by: day | last post by:
I know I've seen this issue described before, but I can't find it, or the solution now that I need it. I have some css-specified floating divs that contain images or text. The text divs have a...
7
by: Johnny | last post by:
June 2, 2005 Greetings, I have a whole lot of questions that all have to do with the same topic: Width. By "width" I mean how wide a particular Web page is, how wide a table is, how wide a...
0
by: smilla | last post by:
Hi, I'm trying to use css to set the widths of cells and tables, for multiple tables. The width of the tables is 450px, set in stylesheet. The number of columns and widths vary, but I'd...
6
by: Hacking Bear | last post by:
Hi, I still don't quite fully understand how to handle mixing border/margin pixel width with percentage width. In the example below, I want to place side-by-side two DIV boxes inside a box....
1
by: Yobbo | last post by:
Hi Just want to confirm what the CSS equiv is for the old method of using * as the remainder of a space, eg cols="100,*,50". Did this actually ever work for the width of something, eg 3 x...
2
by: neuneudr | last post by:
Hi everybody, I'm scratching my head with a CSS problem. I want to have the following (the two pics have these size for a good reason, the whole point of the page is basically to show these...
4
by: fjm | last post by:
Hello everyone, I have a question regarding css where I would like to know if it is possible to break up a page into thirds for the height. I need to have a page that will be 100% in height and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.