Monday, March 26, 2012
set div width to remaining width of the browser
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,
-SteveDo 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
>
On Jun 15, 2:00 pm, Yuriy Solodkyy <y.dot.solod...@.gmail.com> 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...81932373&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
set div width to remaining width of the browser
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,
-SteveDo 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>
Quote:
Originally Posted by
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
>
On Jun 15, 2:00 pm, Yuriy Solodkyy <y.dot.solod...@.gmail.comwrote:
Quote:
Originally Posted by
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...81932373&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
Set DIV text in code behind
html:
<div id="divtest" runat=server></div>
code behind:
protected System.Web.UI.HtmlControls.WHAT?? divtest;
...
...
divtest.WHAT?? = "seems to work";Html part is fine. After you've created it, look at it in the design view, save the page, then go to the codebehind, you should be able to see an html div control (some name)... set its innerText property.
hmmm...not so sure
I always have to code the "protected htmlcontrol whatever mycontrol" myself in my project. VS never do it for me. SOMETIMES, VS will add this for me for asp.net controls though.
Maybe something to do with the fact I ALWAYS hand code my pages...never drag and drop onto form...
...aaah...stupid me..let me drag some html controls onto the form and see what VS do for me... sorry..always talk to myself huh?
It's a VS 2003 bug that I discovered much to my consternation when VS 2003 had just come out. Surprisingly, it was addressed by nobody. Everyone thought it was a feature rather than a bug, I even asked MS developers about it, and they did fix it in VS 2005 but they mentioned that very few people ever brought it up regarding VS 2003.
The workaround was that you have to save the ASPX page before going to the codebehind so that the control's code was added to the codebehind file.