homepage Welcome to WebmasterWorld Guest from 54.166.122.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

    
Need For !DOCTYPE!
VividDreamer

5+ Year Member



 
Msg#: 3860041 posted 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#: 3860041 posted 10:33 pm on Feb 28, 2009 (gmt 0)

get rid of half that code.....

VividDreamer

5+ Year Member



 
Msg#: 3860041 posted 10:43 pm on Feb 28, 2009 (gmt 0)

like what parts

tedster

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



 
Msg#: 3860041 posted 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

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



 
Msg#: 3860041 posted 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

WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 3860041 posted 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