Forum Moderators: open

Message Too Old, No Replies

must doc type have the URL in it?

"http://www.w3.org/TR/html4/loose.dtd">

         

annej

7:21 am on Jun 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For example I can't use

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

because with that my css code to get a max width in IE doesn't work.

I've used
width:expression(document.body.clientWidth > 825? "800px": "auto" );

the max width works fine in firefox or netscape but I have to have the fix for IE.

My question is this. Does it really matter that much if the "http://www.w3.org/TR/html4/loose.dtd" is in there?

I really don't want to give up the max width.

topr8

7:46 am on Jun 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



yes it does!

if you actually go to the page
[w3.org...]

you'll see why.

it basically contains the instructions.

theoretically you could write your own doctype and as long as you put it in a publically accessable place browsers could use it.

kaled

9:22 am on Jun 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nope, it doesn't matter one jot. I've had to ditch the url because of a bug in IE standards mode too.

With or without the url, the code validates just the same. If you need to remove it to make the page render correctly then do so. Your time can be better spent elsewhere.

Kaled.

topr8

11:22 am on Jun 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



it does matter, wether it works or not is a different question.

pages render fine in all the commonly used browsers without using the doc type at all, just as if you don't even use the <html></html> opening and closing tags

kaled

1:49 pm on Jun 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If a page renders correctly without the doctype url, but renders incorrectly with the url, I can think of no sensible reason for not simply removing the url.

If anyone can state one single cogent reason for spending time devising an alternative solution that may involve conditional comments and/or javascript and browser-sniffing, I will be utterly astonished.

Kaled.

moltar

2:11 pm on Jun 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you trying to implement min-width property? There is a good JS tidbit called minmax.js that works by simple including it in the header and using the regular min-width CSS property.

encyclo

4:33 pm on Jun 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



As it appears that you are converting an existing page/template rather than creating a new one, then I agree with Kaled that, if the "full" doctype breaks your page, you should revert to the half doctype without the URL.

Using the full doctype is good practice when building new designs, as it ensures a standards-compliant rendering mode in the browser, making it much easier to get CSS to work the same cross-browser. On old pages which still depend on tables for layout, "what works" is usually more important. :)

theoretically you could write your own doctype and as long as you put it in a publically accessable place browsers could use it.

Browsers don't actually read DTDs at all, the doctype URL is there for the validator only. The only effect of the doctype in the browser is to action the rendering mode switch.

annej

6:29 pm on Jun 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes I am converting existing pages. But even if it was a new site I would want the minimum width on IE and since it doesn't recognize max-width I have no other choice.

I've been reading a lot about usability and by setting the max width my articles can be read comfortably even on a very large screen. Using a fix width means I have to make it narrow enough for 800x600 which looks really lost on a large screen.

Anyway I will go without the link for now. Thanks everyone for your input.