Jump to content

Recommended Posts

Hey

I'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.html
http://wuhtzu.dk/random/doctype/doctype.html

When 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 regards
Wuhtzu
Link to comment
https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/
Share on other sites

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
Link to comment
https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-101658
Share on other sites

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]
Link to comment
https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-101834
Share on other sites

  • 3 weeks later...
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.
Link to comment
https://forums.phpfreaks.com/topic/22621-which-doctype-to-use/#findComment-111310
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.