Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > <table> doesnt have a height attribute but still works?

Reply
Thread Tools

<table> doesnt have a height attribute but still works?

 
 
Tim Warnock
Guest
Posts: n/a
 
      08-31-2003
according to html 4.01 it doesnt have a property: yet it works in
ie/mozilla?

what are we supposed to do to make a table using a height percentage?

ie:

+----------------------------+
| |
| |
| 100% x 60% |
| |
| |
| |
+----------------------------+
| 100% x 40% |
| |
+----------------------------+

--
Thanks
Tim Warnock

 
Reply With Quote
 
 
 
 
EightNineThree
Guest
Posts: n/a
 
      08-31-2003

"Tim Warnock" <(E-Mail Removed)> wrote in message
news:birhpb$hi3$(E-Mail Removed)...
> according to html 4.01 it doesnt have a property: yet it works in
> ie/mozilla?
>


No it doesn't
<repost>
Here we see a 100 pct (height and width) table -
http://karlcore.com/100pcttable/100pctnodtd.php
Notice how this "works". Unfortunately, it only works because there is no
DTD. As such, it throws the browser into "Quirks mode".
Last I checked, it worked in all browsers.

This may be a suitable "workaround" for some people, but it is not for me. I
care about the quality of my work and I will not walk around topless with no
DTD.
This is the same exact page with an HTML 4.01 Strict DTD -
http://karlcore.com/100pcttable/100pctwithdtd.php
Notice that despite the fact that the "height" attribute remains on the
table element, it does not show up? This is because the browser is no
longer in "Quirks mode" but is rather following the DTD we have given to it.
(It is also still not valid markup because of the height attribute)

Now, there may be a solution to this issue, borrowed from our pal, Brucie
and a post he made to CIWAH -
http://karlcore.com/100pcttable/100pctcsswithdtd.php
This is 100% valid HTML 4.01 Strict and does what is intended.


Simply put - if you have to find a way to make something work - fix the
design.


--
Karl Core

Charles Sweeney says my sig is fine as it is.


 
Reply With Quote
 
 
 
 
Tim Warnock
Guest
Posts: n/a
 
      08-31-2003
is this a valid use then?

<table width="100%" border="1" cellpadding="3" style="height: 67%;">

it validates for 4.01 traditional and appears to work

--
Thanks
Tim Warnock

ISP Technical Manager
GetOnIt! Nationwide Internet.
1300 88 00 97
timoid (at) getonit.net.au
"EightNineThree" <(E-Mail Removed)> wrote in
message news:biri4o$jkh$(E-Mail Removed)...
>
> "Tim Warnock" <(E-Mail Removed)> wrote in message
> news:birhpb$hi3$(E-Mail Removed)...
> > according to html 4.01 it doesnt have a property: yet it works in
> > ie/mozilla?
> >

>
> No it doesn't
> <repost>
> Here we see a 100 pct (height and width) table -
> http://karlcore.com/100pcttable/100pctnodtd.php
> Notice how this "works". Unfortunately, it only works because there

is no
> DTD. As such, it throws the browser into "Quirks mode".
> Last I checked, it worked in all browsers.
>
> This may be a suitable "workaround" for some people, but it is not

for me. I
> care about the quality of my work and I will not walk around topless

with no
> DTD.
> This is the same exact page with an HTML 4.01 Strict DTD -
> http://karlcore.com/100pcttable/100pctwithdtd.php
> Notice that despite the fact that the "height" attribute remains on

the
> table element, it does not show up? This is because the browser is

no
> longer in "Quirks mode" but is rather following the DTD we have

given to it.
> (It is also still not valid markup because of the height attribute)
>
> Now, there may be a solution to this issue, borrowed from our pal,

Brucie
> and a post he made to CIWAH -
> http://karlcore.com/100pcttable/100pctcsswithdtd.php
> This is 100% valid HTML 4.01 Strict and does what is intended.
>
>
> Simply put - if you have to find a way to make something work - fix

the
> design.
>
>
> --
> Karl Core
>
> Charles Sweeney says my sig is fine as it is.
>
>


 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      08-31-2003
Tim Warnock wrote:>>

> is this a valid use then?


> <table width="100%" border="1" cellpadding="3" style="height: 67%;">


> it validates for 4.01 traditional and appears to work


Height and width are "floating" variables. If you specify neither, both will
vary in accordance with content.
IMHO, height should never be a %. unless it's a nested table.
Unless you define the page size, how does height know what to use as 100%?



> --
> Thanks
> Tim Warnock


> ISP Technical Manager
> GetOnIt! Nationwide Internet.
> 1300 88 00 97
> timoid (at) getonit.net.au
> "EightNineThree" <(E-Mail Removed)> wrote in
> message news:biri4o$jkh$(E-Mail Removed)...
>>
>> "Tim Warnock" <(E-Mail Removed)> wrote in message
>> news:birhpb$hi3$(E-Mail Removed)...
> >> according to html 4.01 it doesnt have a property: yet it works in
> >> ie/mozilla?
> >>

>>
>> No it doesn't
>> <repost>
>> Here we see a 100 pct (height and width) table -
>> http://karlcore.com/100pcttable/100pctnodtd.php
>> Notice how this "works". Unfortunately, it only works because there

> is no
>> DTD. As such, it throws the browser into "Quirks mode".
>> Last I checked, it worked in all browsers.
>>
>> This may be a suitable "workaround" for some people, but it is not

> for me. I
>> care about the quality of my work and I will not walk around topless

> with no
>> DTD.
>> This is the same exact page with an HTML 4.01 Strict DTD -
>> http://karlcore.com/100pcttable/100pctwithdtd.php
>> Notice that despite the fact that the "height" attribute remains on

> the
>> table element, it does not show up? This is because the browser is

> no
>> longer in "Quirks mode" but is rather following the DTD we have

> given to it.
>> (It is also still not valid markup because of the height attribute)
>>
>> Now, there may be a solution to this issue, borrowed from our pal,

> Brucie
>> and a post he made to CIWAH -
>> http://karlcore.com/100pcttable/100pctcsswithdtd.php
>> This is 100% valid HTML 4.01 Strict and does what is intended.
>>
>>
>> Simply put - if you have to find a way to make something work - fix

> the
>> design.
>>
>>
>> --
>> Karl Core
>>
>> Charles Sweeney says my sig is fine as it is.
>>
>>



 
Reply With Quote
 
Toby A Inkster
Guest
Posts: n/a
 
      08-31-2003
Tim Warnock wrote:

> <table width="100%" border="1" cellpadding="3" style="height: 67%;">


67% of what? This certainly doesn't mean 67% of the screen height -- it
means 67% of the body height. But how tall is the body? The body is only
as big as the elements that it contains -- possibly just this table. So
the body is the same height as the table. But then the table has to be 67%
of the height of the body, etc -- the height of each is defined in terms
of the other. Not a good situation to find yourself in.

--
Toby A Inkster BSc (Hons) ARCS | (E-Mail Removed) | pgp:0x6A2A7D39
aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:(E-Mail Removed)
http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
playing://(nothing)
 
Reply With Quote
 
Nico Schuyt
Guest
Posts: n/a
 
      08-31-2003
Tim Warnock wrote:
> what are we supposed to do to make a table using a height percentage?


With CSS? See code below
(Tested in IE5.5 and Mozilla1. In fact in surprises me. Thought it was not
possible)
Regards, Nico

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<title>Test</title>
<style type="text/css">
body {
text-align: center;
font-family: sans-serif;
margin: 10px;}
table {margin-left:auto; margin-right: auto; width: 100%; height: 100%}
..w30 {width: 30%;}
..w70 {width: 70%}
..h40 {height: 40%}
..h60 {height: 60%}
td, th {border: 1px solid black; color: black; background: blue}
</style>
</head>
<body>
<table>
<tr class="h60">
<th class="w30">&nbsp;</th>
<th class="w70">&nbsp;</th>
</tr>
<tr class="h40">
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</body
</html>



 
Reply With Quote
 
Nico Schuyt
Guest
Posts: n/a
 
      08-31-2003
Richard wrote:
> IMHO, height should never be a %. unless it's a nested table.
> Unless you define the page size, how does height know what to use as
> 100%?


Ehhh, is % of window size not logical?
Nico


 
Reply With Quote
 
David Dorward
Guest
Posts: n/a
 
      08-31-2003
Nico Schuyt wrote:
> Richard wrote:
>> IMHO, height should never be a %. unless it's a nested table.
>> Unless you define the page size, how does height know what to use as
>> 100%?


> Ehhh, is % of window size not logical?


It might be logical, but CSS doesn't have a special case for elements which
are children of the body.

The short version is: "If an element has height: 100% and its parent element
has height: auto then the element with height: 100% changes to height:
auto".

--
David Dorward http://dorward.me.uk/
 
Reply With Quote
 
Nico Schuyt
Guest
Posts: n/a
 
      08-31-2003
David Dorward wrote:
> Nico Schuyt wrote:


>> Ehhh, is % of window size not logical?


> It might be logical, but CSS doesn't have a special case for elements
> which are children of the body.
> The short version is: "If an element has height: 100% and its parent
> element has height: auto then the element with height: 100% changes
> to height: auto".


Not sure I understand it correctly so forgive my stupid remarks :
- 'height: auto' means that "the browser calculates the actual height" isn't
it?
I can't find the basis/formula of that calculation. Doesn't that makes the
result unpredictable?
- If no height of the parent (like 'body') is defined, and the child has
height: 100%, isn't that 100% of window size?
Regards, Nico


 
Reply With Quote
 
David Dorward
Guest
Posts: n/a
 
      08-31-2003
Nico Schuyt wrote:

>> The short version is: "If an element has height: 100% and its parent
>> element has height: auto then the element with height: 100% changes
>> to height: auto".

>
> - 'height: auto' means that "the browser calculates the actual height"
> isn't it?


The height of the element is dependent on its content.

> I can't find the basis/formula of that calculation. Doesn't that makes the
> result unpredictable?


Its as big as it needs to be

> - If no height of the parent (like 'body') is defined, and the child has
> height: 100%, isn't that 100% of window size?


No. The height of the parent (in this case "body") is defined - its the
default: auto. So the body is as big as it needs to be. When a height is
specified in percentages and the parent element has height: auto, then the
height: x% becomes height: auto.

The result is that the table gains height: auto, so the table is as tall as
it needs to be and no taller - which is the default anyway.

--
David Dorward http://dorward.me.uk/
 
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
sort list doesnt work, key=str still doesnt work notnorwegian@yahoo.se Python 3 05-27-2008 04:32 AM
Validation (XHTML 1.0 Transitional): Attribute 'height' is not a valid attribute of element 'table' perspolis ASP .Net 1 01-23-2007 07:57 AM
PC doesnt boot first time and doesnt shutdown dann Computer Support 6 08-21-2006 07:31 AM
Height Code doesnt work with FireFox DaveO Javascript 0 08-05-2005 06:55 AM
When I open Internet Explorer, along with my home page a pop page pops up, I have changed home page but that doesnt work Phil Computer Support 7 03-04-2004 12:22 AM



Advertisments