Welcome to WebmasterWorld Guest from 54.167.76.176

Forum Moderators: not2easy

Message Too Old, No Replies

Need For !DOCTYPE!

     

VividDreamer

10:23 pm on Feb 28, 2009 (gmt 0)

5+ Year Member



Why is it that I have to use the !DOCTYPE to make the page work in ie but not in firefox?! I thought it would work with or without it. Is it possible to do that?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

[edited by: VividDreamer at 11:09 pm (utc) on Feb. 28, 2009]

wyweb

10:33 pm on Feb 28, 2009 (gmt 0)



get rid of half that code.....

VividDreamer

10:43 pm on Feb 28, 2009 (gmt 0)

5+ Year Member



like what parts

tedster

10:57 pm on Feb 28, 2009 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member



See Guide to Posting HTML and CSS [webmasterworld.com] -Please read before posting!

It's linked to the top of this forum's index page.

swa66

11:34 pm on Feb 28, 2009 (gmt 0)

WebmasterWorld Senior Member swa66 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



If you post that much code: very few will read it, so it's a futile effort in the end.

Doctype: yes you want one. Otherwise you trip at least IE6 into quirks mode. It won't hurt anything (except at worst your ego when you try to validate perhaps)

Validate your code.

Secondly use the cascade, if you have nearly identical code block like e.g. your h1 and h2 do it like this:


h1, h2 {
/* common code here */
}
h1 {
/* specific code */
}
h2 {
/* specific code */
}

Use the shorthand versions.

Use lists of fonts for font-family, e.g.
font-family: Verdana, Arial, Helvetica, sans-serif
You cannot expect any single font like Verdana to be universally available. Terminate the list with a generic font (like serif or sans-serif)

Learn what the defaults are and don't set them.

Learn the shorthand properties.

And last but not least, do read the link given to you by tedster before posting code. Oh and no links, specifics, policital content, ... on here.

rocknbil

5:15 pm on Mar 1, 2009 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Why is it that I have to use the !DOCTYPE to make the page work in ie but not in firefox?! I thought it would work with or without it.

A further addition, what is happening is in quirks mode, some selectors will fail, some will not. When in quirks mode, it's left up to the browser to decide what's "valid" and what's not, so it's going to vary from browser to browser.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

A point to consider is why you are using an XHTML doctype. If your page is plain HTML, this not only misrepresents the document type, it makes validating a little more difficult because some elements are not supported by XHTML strict.

Choosing the best doctype for your site [webmasterworld.com]

Why most of us should NOT use XHTML [webmasterworld.com]

[edited by: encyclo at 11:05 pm (utc) on Mar. 1, 2009]
[edit reason] fixed link [/edit]

 

Featured Threads

Hot Threads This Week

Hot Threads This Month