By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,246 Members | 1,401 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,246 IT Pros & Developers. It's quick & easy.

How to make a table render to the width of the window ?

P: n/a

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 this mean the width of the browser's
window ? On 800x600 IE6.0 the window has a horzontal scroll bar, wich I
don't want to be there. You know, sometimes, with other tables, it works...

How can I make the table so that:
- the whole table width is the browser's window width
- the first colomn of the table has it's intrinsic width (minimum width
required, 0*)
- and the second table has the remaining width, no less than a given
minimum width ?

I tried setting the table width to 100% with CSS (the width of the body
element); it didn't work

--
Thank you
Timothy Madden
---------------------------
And I don't wanna miss a thing
Jul 20 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Els

Timothy Madden wrote:
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 this mean the width of the browser's
window ? On 800x600 IE6.0 the window has a horzontal scroll bar,
Not only on 800x600, it has a scrollbar at 1280x1024 as well...
wich I
don't want to be there. You know, sometimes, with other tables, it works...

How can I make the table so that:
- the whole table width is the browser's window width
By setting the width at 100%, or rather 99%, to avoid the
horizontal scrollbar in some browsers because of margins of
body and stuff.
- the first colomn of the table has it's intrinsic width (minimum width
required, 0*)
you did that already, it seems?
- and the second table has the remaining width, no less than a given
minimum width ?
you mean second column?
I tried setting the table width to 100% with CSS (the width of the body
element); it didn't work


That may be because the line
/usr/local/etc/Suids:/usr/local/bin:/usr/bin:/usr/sbin:/usr/dt/bin:/usr/openwin/bin:/usr/proc/bin:/usr/ccs/bin:/usr/openwin/bin/demo:/var/qmail/bin:/usr/local/java2sdk/bin:/usr/local/teTeX/bin/sparc-sun-solaris2.5.1:/usr/local/pgsql/bin:/usr/local/oracle/Soft/805/bin:/opt/bin:/usr/local/oracle/bin:.:/usr/local/sbin
just can't wrap.
Well, it dus wrap in IE, but only because of the hyphen in
sparc-sun-solaris2.5.1 ;-)
--
Els

Mente humana é como pára-quedas; funciona melhor aberta.

Jul 20 '05 #2

P: n/a
Els <el*********@tiscali.nl> wrote:
I tried setting the table width to 100% with CSS (the width of the
body element); it didn't work


That may be because the line
/usr/local/etc/Suids:/usr/ - -
/bin:/usr/local/oracle/bin:.:/usr/local/sbin just can't wrap.


Quite right. The browser either expands the table to fit, or lets the
content overflow, or truncates it. This depends on many things,
including the setting of the table-layout property (in CSS).

Or it _could_ wrap, but browsers are not required to wrap it. Actually
the OP's page, or service, seems to have goals similar to the simple
"echo HTTP headers" script that I wrote recently, and I encountered
similar problems. The background (namely browsers not wrapping strings
with no whitespace and ways to deal with it) are explained at
http://www.cs.tut.fi/~jkorpela/html/nobr.html#suggest

What I do in practice (see the effect at
http://www.cs.tut.fi/cgi-bin/run/~jkorpela/headers.cgi )
is to insert <wbr> after each comma and after each slash in the cell
that shows an HTTP header value. Those headers seem to use spaces
rather sparingly, so something needs to be done. I haven't figured out
a simple way to defeat IE's eagerness to break a line after a hyphen
here, so I will just tolerate things like application/vns.ms-
excel

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #3

P: n/a
It seems "Timothy Madden" wrote in
comp.infosystems.www.authoring.html:
Now the table has the width property set to 100%, which should mean the
width available to the browser. Does this mean the width of the browser's
window ?


Yes, however the width="100%" is a _suggestion_ that gets overridden
by content.

Because your "path" entry is very very very long and contains no
spaces, the table is about four times the width of my window.

--
Stan Brown, Oak Road Systems, Cortland County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2 spec: http://www.w3.org/TR/REC-CSS2/
2.1 changes: http://www.w3.org/TR/CSS21/changes.html
validator: http://jigsaw.w3.org/css-validator/
Jul 20 '05 #4

P: n/a

Ok, Thank you.
I got it now.
Too bad HTML doesn't have more options about text wrapping

--
Timothy Madden
-------------------------
And I don't wanna miss a thing
Jul 20 '05 #5

P: n/a
DU
Stan Brown wrote:
It seems "Timothy Madden" wrote in
comp.infosystems.www.authoring.html:
Now the table has the width property set to 100%, which should mean the
width available to the browser. Does this mean the width of the browser's
window ?

Yes, however the width="100%" is a _suggestion_ that gets overridden
by content.

Because your "path" entry is very very very long and contains no
spaces, the table is about four times the width of my window.

There are other issues too.

1- <table width="100%" ...> is 100% of the available width as given by
its immediate containing parent in the containment hierarchy: in this
case, the <body>. Now, the default css declaration for the body element
in MSIE 6 for windows (in both rendering modes) is with a
margin: 15px 10px
which is NOT overriden by the file
http://web.ss.pub.ro/~bat/HelloWorld.css
The whole table could not be as wide as the browser's window width
anyway, regardless of the content issue

2- MSIE 6 for windows has a major bug on overflow:visible

3- The default css declaration for the root element in MSIE 6 is
border { medium #000000 inset } // not 0px none;
overflow { visible scroll } // not overflow: auto;

DU

Jul 20 '05 #6

P: n/a
Timothy Madden <ba****@rmv.spam.home.ro> wrote:
Too bad HTML doesn't have more options about text wrapping


Actually HTML has lots of options for text wrapping. You just need two
things: to understand the Unicode line breaking rules and control
characters for it, which might take just a few years, and to wait for
browser vendors understand and implement them, which probably takes
considerably longer. :-)

Seriously, you're right. Things like <nobr> and <wbr> should have been
standardized long ago.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 20 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.