Wuhtzu Posted September 30, 2006 Share Posted September 30, 2006 HeyI'm having trouble choosing the right doctype for my html files. My problem is that when I include a doctype, like [b]<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">[/b] some of my css doesn't work.It is the height property for a table that doesn't work:[b]style.css[/b][code]table.table{ width: 100%; height: 100%; border-style: solid; }[/code][b]html file[/b][code]<html><head> <link rel="stylesheet" type="text/css" href="style.css"></head><body><table class="table"> <tr> <td>skid mig i munden </td> </tr></table></body></html>[/code]The result can be seen here:http://wuhtzu.dk/random/doctype/nodoctype.htmlhttp://wuhtzu.dk/random/doctype/doctype.htmlWhen the doctype is specified the [b]height: 100%;[/b] doesn't apply. I have been looking at this list for hours http://www.w3.org/QA/2002/04/valid-dtd-list.html and eventually tryied almost all of them without any luck.Which doctype should i choose?Best regardsWuhtzu Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/ Share on other sites More sharing options...
Wuhtzu Posted October 1, 2006 Author Share Posted October 1, 2006 Sorry for asking such a dumb question. It is of course me who should write according to the doctype and not the other way round. Sedondly the page is viewed correctly when the <!DOCTYPE> is specified -> height 100% is 100% of the parent element, which is <body> and <body> doesn't fill the browser windows vertically. Wuhtzu Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-101658 Share on other sites More sharing options...
Daniel0 Posted October 1, 2006 Share Posted October 1, 2006 I would use XHTML 1.1: [code]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">[/code] Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-101739 Share on other sites More sharing options...
Wuhtzu Posted October 1, 2006 Author Share Posted October 1, 2006 Why use the xhtml-doctype when it isn't xhtml? Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-101787 Share on other sites More sharing options...
Daniel0 Posted October 1, 2006 Share Posted October 1, 2006 Well it would be better if you changed from HTML to XHTML. There is not that much difference, but XHTML is better. As far as I can see, the code you posted do already follow the XHTML 1.1 rules (or whatever to call it).[url=http://www.w3.org/TR/xhtml11/]More info about XHTML 1.1[/url] Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-101834 Share on other sites More sharing options...
FrOzeN Posted October 1, 2006 Share Posted October 1, 2006 To conform to XHTML, you would have to change your link tag so it closes .. ="style.css"> would become ="style.css" /> Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-101857 Share on other sites More sharing options...
Daniel0 Posted October 1, 2006 Share Posted October 1, 2006 Ah yeah, didn't notice. Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-101879 Share on other sites More sharing options...
Wuhtzu Posted October 1, 2006 Author Share Posted October 1, 2006 Thanks for the advice, I'll concider to validate the code as both html 4.01 and xhtml 1.1 :)Of course the posted code is just an ultra simple example, but it was during the height=100% of a table i noticed the problem...Wuhtzu Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-101887 Share on other sites More sharing options...
dbrimlow Posted October 19, 2006 Share Posted October 19, 2006 Actually, the reason most of us are starting to use XHTML is because it gets us away from using HTML tags that are eventually going to be obsolete. It helps break you of being lazy and using junk code that MS loves so much - I am now in the habit of closing all tags. It is important, particularly when using css, because if you don't close a tag, that style will bleed into the next tag.If you are converting a huge number of old html to make them valid, it may be better to start with using html 4 transitional.But remember, the doctype is only the first step. You must make sure you actually then write valid code for that particular doctype.And for any web developer that means using two great tools.1. the w3c html validator [url=http://validator.w3.org/]http://validator.w3.org/[/url]2. Firefox with the webdeveloper toolbar extension. I couldn't imagine life online without this fabulous toolbar. Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-111310 Share on other sites More sharing options...
fenway Posted October 19, 2006 Share Posted October 19, 2006 If you must use a doctype, stick with 4.01 transitional so that you don't break everything -- and HTML will never be obsolete, so don't move to XHTML unless you actually know why you should bother. Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-111393 Share on other sites More sharing options...
michaellunsford Posted October 19, 2006 Share Posted October 19, 2006 try adding this to your CSS[code=php:0]html,body { height:100%;}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-111412 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.