Connecting Tech Pros Worldwide Help | Site Map

Table height in % useing using the XHTML 1.0 Transitional

bugboy's Avatar
Familiar Sight
 
Join Date: Sep 2007
Location: Ontario
Posts: 146
#1: Feb 10 '09
I'm using the XHTML 1.0 Transitional DOCTYPE so that CSS a:hover{color:orange;} 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!

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html>
  3. <head>
  4. <title>Untitled Document</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. </head>
  7.  
  8. <body>
  9.  <div id="box" style="background-color:blue; height:80%; width:200px;">&nbsp;</div>
  10. </body>
  11. </html>
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,560
#2: Feb 10 '09

re: Table height in % useing using the XHTML 1.0 Transitional


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{height: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.
bugboy's Avatar
Familiar Sight
 
Join Date: Sep 2007
Location: Ontario
Posts: 146
#3: Feb 11 '09

re: Table height in % useing using the XHTML 1.0 Transitional


Thanks, that's got it!
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,629
#4: Feb 13 '09

re: Table height in % useing using the XHTML 1.0 Transitional


Quote:

Originally Posted by bugboy View Post

Expand|Select|Wrap|Line Numbers
  1. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

1) empty elements must be assigned as such
Expand|Select|Wrap|Line Numbers
  1. <meta ... />
2) if you set the mime type to text/html, why declaring XHTML? (browsers will treat your markup as HTML anyways)

regards
Reply