homepage Welcome to WebmasterWorld Guest from 54.198.130.203
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
Need For !DOCTYPE!
VividDreamer




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

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




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

get rid of half that code.....

VividDreamer




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

like what parts

tedster




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

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




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

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




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

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]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved