Table height in % useing using the XHTML 1.0 Transitional

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bugboy
    New Member
    • Sep 2007
    • 160

    #1

    Table height in % useing using the XHTML 1.0 Transitional

    I'm using the XHTML 1.0 Transitional DOCTYPE so that CSS a:hover{color:o range;} will work but now it won't let me specify the div height in %.. Anyone know what i should do? how can i specify height in % or do both with some other doc type or method?

    Thanks!

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body>
     <div id="box" style="background-color:blue; height:80%; width:200px;">&nbsp;</div>
    </body>
    </html>
  • drhowarddrfine
    Recognized Expert Expert
    • Sep 2006
    • 7434

    #2
    When you use percentage, you have to always ask yourself "percent of what?". It's always relative to the parent of the container. In this case, your div is contained by the body. So set the body to 'height:100%'.

    But then the question must be asked again. 100% of what? Of its parent which is <html>.

    html,body{heigh t:100%}

    You do not need XHTML or transitional to get a:hover to work. It works with any doctype. New pages have no need for transitional either.

    Comment

    • bugboy
      New Member
      • Sep 2007
      • 160

      #3
      Thanks, that's got it!

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Originally posted by bugboy
        Code:
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        1) empty elements must be assigned as such
        Code:
        <meta ... />
        2) if you set the mime type to text/html, why declaring XHTML? (browsers will treat your markup as HTML anyways)

        regards

        Comment

        Working...