Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: DOCTYPE XHTML problem

  1. #1
    Join Date
    Dec 2005
    Posts
    133
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Default DOCTYPE XHTML problem

    somehow this doctype does not support the 100% height I give to my main table.
    I just wrote it like that
    <table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">

    Any idea how to fix it?

  2. #2
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by emanuelle
    somehow this doctype does not support the 100% height I give to my main table.
    This isn't an issue that is restricted to XHTML; table elements don't have height attributes in HTML, either.

    By the way, serving XHTML as HTML is pointless at best. If you are working with XML server-side, transform the output to HTML, first. If you are simply writing a document by hand, use HTML (HTML 4.01 Strict, preferably).

    Any idea how to fix it?
    Remove the height attribute, and use CSS, instead. However, note that percentage values used with the height property has limitations. The containing block (typically the parent element) must have an explicit height property, otherwise the value is considered to be the same as the value, auto.

    Mike

  3. #3
    Join Date
    Dec 2005
    Posts
    133
    Thanks
    23
    Thanked 0 Times in 0 Posts

    Default

    when I use HTML 4.01 Strict the height=100% in the table works.
    I want the page to be 100% (height) and I have to use the XHTML doctype for further implementation.

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    1) It is always helpful if you leave a URL to your problem.

    2) If your website is table based, then the default height is 100%. The only way it will be less then 100% is if you do not have enough content to fill the page to its base.

    3) You should use the DOCTYPE to ensure the document is properly viewable to all standard compliant browsers eg.. just about all but IE HaHa

    4)I would suggest you look into getting away from structuring your entire website without the dependency of tables. http://w3schools.org is a place you can get started on learning how to implement structuring based on "div"

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by emanuelle
    when I use HTML 4.01 Strict the height=100% in the table works.
    I want the page to be 100% (height) and I have to use the XHTML doctype for further implementation.
    In which browsers? I have seen 100% height 'work' in a non-standards compliant browser like IE, sometimes. Usually it causes problems in all other browsers and often breaks down, when you least expect it, even in IE.

    Oddly enough, sometimes the situation vis a vis browsers and 100% height gets reversed. In either case, having your page work in only some browsers isn't generally a good thing. There is almost always a better way to get the desired layout than height 100%.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    For it to be 100%, (as in: really 100%) the margins also have to be 0

    Code:
    <style type="text/css">
    body {
    margin:0px
    }
    </style>
    - Mike

  7. #7
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    pissa:Um..I think you mean w3schools.com

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    2) If your website is table based, then the default height is 100%. The only way it will be less then 100% is if you do not have enough content to fill the page to its base.
    Nonsense. The "default height" is the minimum possible whilst accommodating the content.
    3) You should use the DOCTYPE to ensure the document is properly viewable to all standard compliant browsers eg.. just about all but IE HaHa
    S/he is using a DOCTYPE, as is clear from the title and post.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    1) If the content is less then the viewed height, the table will not appear to be 100%.

    2) Mike is correct about the margin rule...
    Code:
    table {
    margin:0;
    padding:0;
    }
    is the only true way of making a table 100% height... but that would also make it 100% width too...
    Code:
    margin-top 0;
    margin-bottom: 0;
    would make it 100% height then you could do whatever youw anted with the width

  10. #10
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    (surfer-dude accent) Don't argue with the Twey, man.. Just be cool with whatever, dude..
    - Mike

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •