>| -----BEGIN PGP SIGNED MESSAGE-----
>| Hash: SHA1
[quoted text clipped - 10 lines]
>|
>| One possible application is to fix some of the holes in a table layout.
Don't use tables, in this instance, as they'll cause you nothing but
grief. The table layout engine is a law unto itself. Any table width
definitions are only a guideline for the layout engine and nothing
more.
>| For example, say I want a three-column layout where the first column is 100px
>| wide, the second column occupies 75% of what's left, and the third column
>| occupies the rest of the space but may be no narrower than any of its
>| fixed-size children.
What you are describing here is 3 column liquid/fluid layout. This
topic is discussed almost daily in the
comp.infosystems.www.authoring.stylesheets (ciwas) newsgroup
>| I'm not a CSS expert, but I don't believe this kind of thing is at all
>| possible using stock CSS --- you can only use fixed values in CSS; you
>| can't say anything like 'element X should be narrower than element Y but
>| wider than element Z'. But this kind of thing is trivial for a chunk of
>| Javascript; it just needs to examine the size of the screen and the size of
>| the various interesting elements, do some simple arithmetic, and set it.
While you are correct about the calculations but you can set an onLoad
function to readjust the page once it has finished loading.
Have a look at the following. I've added colour borders just to
highlight the different areas.
It's the 3rd column that is going to cause you problems because of its
width and location (it will move under column 2 if the screen isn't
wide enough).
If you want to pursue the CSS path you might want to ask this question
in the ciwas newsgroup.
---------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>3 Column Layout</title>
<style type="text/css">
/* make level playing field for all browswers */
html, body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
font-size: 100%;
}
/* set container for whole page */
#Container{
border-bottom: 5px solid #DDDDDD;
border-left: 5px solid #DDDDDD;
border-right: 5px solid #DDDDDD;
border-top: 5px solid #DDDDDD;
float: left;
width: 99%;
margin: 0;
padding: 0;
}
/* first column definition */
#Column1 {
float: left;
width: 100px;
border: 2px solid red;
margin: 0;
padding: 0;
}
/* 2nd column definition */
#Column2 {
float: left;
width: 75%;
border: 2px solid lime;
margin: 0;
padding: 0, 6px, 0 6px;
}
/* 3rd column definition */
#Column3 {
float: left;
border: 2px solid blue;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="Container">
<div id="Column1">Column1 Column1 Column1 Column1 Column1 Column1
Column1 </div>
<div id="Column2">Column2 Column2 Column2 Column2 Column2 Column2
Column2 </div>
<div id="Column3">Column3 Column3 Column3 Column3 Column3 Column3
Column3 </div>
</div>
</body>
</html>
---------------------------------------------------------------------
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
David Given - 31 Oct 2005 13:23 GMT
[...]
> While you are correct about the calculations but you can set an onLoad
> function to readjust the page once it has finished loading.
Yes. I know this.
The problem with adjusting the page once the page has finished loading is
that the page is *only* adjusted once the page has finished loading, which
on a slow connection looks bad.
Given that, ideally, I need to recalculate the layout whenever any of the
state that controls the layout changes --- browser window resize, font
change, etc --- it would make sense to also recalculate the layout whenever
more data arrives from the server; I'm trying to determine if this is
possible.
[...]
> If you want to pursue the CSS path you might want to ask this question
> in the ciwas newsgroup.
No, I don't. It was just an example... here's a better one: I want to have
a column layout where the number of columns depends on the width available.
In other words, the columns have a fixed width, and I want to fit in as
many columns as the browser window has space for. This is much the same
behaviour as Windows Explorer windows.
But note that I don't want to solve this *particular* problem. I want to
solve the *class* of problems that this is an instance of; having to do
programmatic layout.
- --
+- David Given --McQ-+ "Quantum materiae materietur marmota monax si
| dg@cowlark.com | marmota monax meteriam possit materiari?" --- Henry
| (dg@tao-group.com) | Beard
+- www.cowlark.com --+