HELP: Table height in the new XHTML???

Discussion in 'ASP .Net' started by Arthur Dent, Dec 23, 2005.

  1. Arthur Dent

    Arthur Dent Guest

    I am completely baffled... i cannot for the life of me get the HEIGHT style
    to work on a table in the new 2005-supported XHTML.
    I put a HEIGHT: 100% on my table so that my footer row will also show up at
    the very bottom of the page (unless content pushes it further down).
    But when the browser renders the page, its as if there was no height
    specified on the table, it all just shrinks up to the top of the page, as
    short as the content will allow.
    Ive tried the height as an inline style attribute, a document-level style
    tag, and a css style sheet. They all fail.

    I cannot imagine the standards-writing-people would kill something like this
    without providing a new way to accomplish it... especially seeing as
    *almost* every professional and/or corporate site i ever look at has this
    style of layout, with a footer which always shows at the bottom of the page,
    or bottom of the browser if the content is shorter than the window.

    HOW CAN I DO THIS?!?!? its driving me crazy!!

    Thanks in advance,
    - Arthur Dent.
     
    Arthur Dent, Dec 23, 2005
    #1
    1. Advertising

  2. Arthur Dent

    Bruce Barker Guest

    Re: Table height in the new XHTML???

    in xhtml, the body does not have a default height, just a default width. for
    a percentage size to work, it needs one of its perents to have an absolute
    value to be a percent of, otherwise its ignored.

    take:

    <!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <body>
    <div style="width:100%;height:100%;background-color:red;">
    </div>
    </body>
    </html>

    now you might expect this markup to create a full screen div thats red. it
    won't, but rather create a div thats the width of the page, and the height
    of one text line. this is because there is no specified height anywhere

    compare to:

    <!DOCTYPE html PUBLIC
    "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <body style="height:200px;">
    <div style="width:100%;height:100%;background-color:red;">
    </div>
    </body>
    </html>

    here we specified a body height, so the div will fill it.


    note: this is the expected behavior of html 4.0 also.

    -- bruce (sqlwork.com)


    "Arthur Dent" <> wrote in message
    news:...
    >I am completely baffled... i cannot for the life of me get the HEIGHT style
    > to work on a table in the new 2005-supported XHTML.
    > I put a HEIGHT: 100% on my table so that my footer row will also show up
    > at
    > the very bottom of the page (unless content pushes it further down).
    > But when the browser renders the page, its as if there was no height
    > specified on the table, it all just shrinks up to the top of the page, as
    > short as the content will allow.
    > Ive tried the height as an inline style attribute, a document-level style
    > tag, and a css style sheet. They all fail.
    >
    > I cannot imagine the standards-writing-people would kill something like
    > this
    > without providing a new way to accomplish it... especially seeing as
    > *almost* every professional and/or corporate site i ever look at has this
    > style of layout, with a footer which always shows at the bottom of the
    > page,
    > or bottom of the browser if the content is shorter than the window.
    >
    > HOW CAN I DO THIS?!?!? its driving me crazy!!
    >
    > Thanks in advance,
    > - Arthur Dent.
    >
    >
    >
     
    Bruce Barker, Dec 23, 2005
    #2
    1. Advertising

  3. Arthur Dent

    Arthur Dent Guest

    Re: Table height in the new XHTML???

    Okay, but that still doesnt answer the q. of HOW do you make a page with a
    footer which always shows at the very bottom of the page between resolutions
    and window resizes? Hardcoded sizes are fine, if you know exactly what size
    the window will be ALL the time, but thats impossible.....

    Can you use expressions as height, so something like HEIGHT:
    document.clientHeight; or something like that? or what? what is the new way
    to do this???


    "Bruce Barker" <> wrote in message
    news:OmQjsW%...
    > in xhtml, the body does not have a default height, just a default width.
    > for a percentage size to work, it needs one of its perents to have an
    > absolute value to be a percent of, otherwise its ignored.
    >
    > take:
    >
    > <!DOCTYPE html PUBLIC
    > "-//W3C//DTD XHTML 1.0 Strict//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    > <html>
    > <body>
    > <div style="width:100%;height:100%;background-color:red;">
    > </div>
    > </body>
    > </html>
    >
    > now you might expect this markup to create a full screen div thats red. it
    > won't, but rather create a div thats the width of the page, and the height
    > of one text line. this is because there is no specified height anywhere
    >
    > compare to:
    >
    > <!DOCTYPE html PUBLIC
    > "-//W3C//DTD XHTML 1.0 Strict//EN"
    > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    > <html>
    > <body style="height:200px;">
    > <div style="width:100%;height:100%;background-color:red;">
    > </div>
    > </body>
    > </html>
    >
    > here we specified a body height, so the div will fill it.
    >
    >
    > note: this is the expected behavior of html 4.0 also.
    >
    > -- bruce (sqlwork.com)
    >
    >
    > "Arthur Dent" <> wrote in message
    > news:...
    >>I am completely baffled... i cannot for the life of me get the HEIGHT
    >>style
    >> to work on a table in the new 2005-supported XHTML.
    >> I put a HEIGHT: 100% on my table so that my footer row will also show up
    >> at
    >> the very bottom of the page (unless content pushes it further down).
    >> But when the browser renders the page, its as if there was no height
    >> specified on the table, it all just shrinks up to the top of the page, as
    >> short as the content will allow.
    >> Ive tried the height as an inline style attribute, a document-level style
    >> tag, and a css style sheet. They all fail.
    >>
    >> I cannot imagine the standards-writing-people would kill something like
    >> this
    >> without providing a new way to accomplish it... especially seeing as
    >> *almost* every professional and/or corporate site i ever look at has this
    >> style of layout, with a footer which always shows at the bottom of the
    >> page,
    >> or bottom of the browser if the content is shorter than the window.
    >>
    >> HOW CAN I DO THIS?!?!? its driving me crazy!!
    >>
    >> Thanks in advance,
    >> - Arthur Dent.
    >>
    >>
    >>

    >
    >
     
    Arthur Dent, Dec 24, 2005
    #3
  4. Arthur Dent

    Alan Silver Guest

    >I cannot imagine the standards-writing-people would kill something like
    >this without providing a new way to accomplish it...


    It's worth pointing out that the standards people didn't kill anything.
    There has never been a height attribute for tables in the HTML
    standards, certainly not for many versions (and I suspect never). The
    only reason why you are coming across the issue now is that MS have
    finally decided to conform to standards instead of breaking them.
    VS2005/VWD reports validation issues, so you start noticing them where
    you never did before.

    > especially seeing as *almost* every professional and/or corporate site
    >i ever look at has this style of layout, with a footer which always
    >shows at the bottom of the page, or bottom of the browser if the
    >content is shorter than the window.


    AFAIK the way people have abused HTML in the past was not used as a
    basis for setting standards for XHTML.

    --
    Alan Silver
    (anything added below this line is nothing to do with me)
     
    Alan Silver, Jan 3, 2006
    #4
  5. Arthur Dent

    simon Guest

    Alan, In my example I would like that red table would be streched to
    the bottom of parent table(when you see my page you will know what I
    mean). It won't work. I have been trying for hours. Nothing helps.
    Please can you help me?
    (If I remove xhtml11 declaration, than it would work.)

    Thanks ,Simon

    My page:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head></head>
    <body>
    <table border=1>
    <tr valign=top><td>
    <table height=100% border=1 style="border-color:red">
    <tR><td height=100% valign=top>
    test
    </td></tr>
    </table>
    </td>
    <td>
    <table>
    <tR><td>
    <table border=1>
    <tR><td>test1</td></tr>
    <tR><td>test2</td></tr>
    <tR><td>test3</td></tr>
    <tR><td>test4</td></tr>
    <tR><td>test5</td></tr>
    </table>
    </td></tr>
    </table>
    </td>
    </tr>
    </table>
    </body>
    </html>
     
    simon, Jan 10, 2006
    #5
  6. Arthur Dent

    Patrice Guest

    AFAIK XHTML uses stylesheets instead inline attributes. Google for CSS,
    "StyleSheet"

    --
    Patrice

    "simon" <> a écrit dans le message de
    news:...
    > Alan, In my example I would like that red table would be streched to
    > the bottom of parent table(when you see my page you will know what I
    > mean). It won't work. I have been trying for hours. Nothing helps.
    > Please can you help me?
    > (If I remove xhtml11 declaration, than it would work.)
    >
    > Thanks ,Simon
    >
    > My page:
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    > "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    > <html xmlns="http://www.w3.org/1999/xhtml">
    > <head></head>
    > <body>
    > <table border=1>
    > <tr valign=top><td>
    > <table height=100% border=1 style="border-color:red">
    > <tR><td height=100% valign=top>
    > test
    > </td></tr>
    > </table>
    > </td>
    > <td>
    > <table>
    > <tR><td>
    > <table border=1>
    > <tR><td>test1</td></tr>
    > <tR><td>test2</td></tr>
    > <tR><td>test3</td></tr>
    > <tR><td>test4</td></tr>
    > <tR><td>test5</td></tr>
    > </table>
    > </td></tr>
    > </table>
    > </td>
    > </tr>
    > </table>
    > </body>
    > </html>
    >
     
    Patrice, Jan 10, 2006
    #6
  7. Arthur Dent

    SimonZ Guest

    I tried also with css, in fact, I use inline attributes here just because of
    ease of example.

    The problem is not because of inline-css.

    The problem is standard which define:

    "for a percentage size to work, it needs one of its perents to have an
    absolute
    value to be a percent of, otherwise its ignored."

    But in my aplication it's impossibble to set absolute value of parent (only
    if I use client script).

    So I create one very simple example with the same problem.

    I wonder if there is someone who can solve this problem using standars(xhtml
    1.1).

    Otherwise, I'll have to use old declarations.

    If that doesn't work by xhtml 1.1 than that is a big lack of functionallity.
    "Percent of" is very usefull and sometimes I can't do without it.

    regards,
    Simon

    "Patrice" <> wrote in message
    news:%...
    > AFAIK XHTML uses stylesheets instead inline attributes. Google for CSS,
    > "StyleSheet"
    >
    > --
    > Patrice
    >
    > "simon" <> a écrit dans le message de
    > news:...
    >> Alan, In my example I would like that red table would be streched to
    >> the bottom of parent table(when you see my page you will know what I
    >> mean). It won't work. I have been trying for hours. Nothing helps.
    >> Please can you help me?
    >> (If I remove xhtml11 declaration, than it would work.)
    >>
    >> Thanks ,Simon
    >>
    >> My page:
    >>
    >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    >> "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    >> <html xmlns="http://www.w3.org/1999/xhtml">
    >> <head></head>
    >> <body>
    >> <table border=1>
    >> <tr valign=top><td>
    >> <table height=100% border=1 style="border-color:red">
    >> <tR><td height=100% valign=top>
    >> test
    >> </td></tr>
    >> </table>
    >> </td>
    >> <td>
    >> <table>
    >> <tR><td>
    >> <table border=1>
    >> <tR><td>test1</td></tr>
    >> <tR><td>test2</td></tr>
    >> <tR><td>test3</td></tr>
    >> <tR><td>test4</td></tr>
    >> <tR><td>test5</td></tr>
    >> </table>
    >> </td></tr>
    >> </table>
    >> </td>
    >> </tr>
    >> </table>
    >> </body>
    >> </html>
    >>

    >
    >
     
    SimonZ, Jan 11, 2006
    #7
  8. Re: Table height in the new XHTML???

    The only way I found is the client script that applies actual browser window
    client height to the BODY element making all content to look as you expect.


    Here is an example:
    I call this function as soon as client page is loaded i.e. via
    RegisterStartupScript method of the Page.ClientScript object on my ASP.NET
    2.0.

    function BodyHeightSet()
    {
    var objRegulatingElement;
    objRegulatingElement = document.body;

    //I don't know if it is working on browsers other then IE 5+
    objRegulatingElement.style.setExpression("pixelHeight",
    "document.documentElement.clientHeight");
    document.recalc(true);

    //!!!!! for other browsers !!!!!
    //You will have to catch the resize event from the body element and
    execute it all the time.
    //objRegulatingElement.style.pixelHeight =
    document.documentElement.clientHeight;
    }
    --
    Eugene U. Zverev,
    Senior Programmer
     
    =?Utf-8?B?ZV96dmVyZXY=?=, Jan 17, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. TheXenocide
    Replies:
    3
    Views:
    6,445
    =?Utf-8?B?ZV96dmVyZXY=?=
    Jan 17, 2006
  2. TheXenocide
    Replies:
    2
    Views:
    3,310
    kchayka
    Oct 28, 2005
  3. Replies:
    2
    Views:
    1,691
    Blinky the Shark
    Jul 20, 2006
  4. perspolis
    Replies:
    1
    Views:
    2,583
    Mark Rae
    Jan 23, 2007
  5. john T
    Replies:
    7
    Views:
    228
    Richard Formby
    Feb 19, 2004
Loading...

Share This Page