当前位置: 动力学知识库 > 问答 > 编程问答 >

Chrome and firefox wont load css with the html 5 doctype

问题描述:

As soon as i place the into my script my page shows perfectly in IE but in firefox and chrome it doesn't load my css file at all.

But when i remove the doctype tag both firefox and chrome show the page perfectly!

And the weird thing is when i load the file locally it works fine with the doctype tag..

Is my host out of date or something?

"Solved"it with:

<!--[if IE]>

<!DOCTYPE html>

<![endif]-->

网友答案:

The solution you found yourself doesn't solve problems, it just puts a bandaid on it by not including a doctype for different browsers which isn't good practice.

网友答案:

You seem to have a lot of CSS errors and warnings, take a look at this link and work your way through them and maybe it will start working...

http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.chatboxlive.com%2Fchat%2Findex2.php&profile=css3&usermedium=all&warning=1&vextwarning=&lang=en

As for your HTML, you have duplicated some id names which is bad markup, take a look here and try either renaming them or changing it to a class as you can have many classes with the same name...

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.chatboxlive.com%2Fchat%2Findex2.php&charset=%28detect+automatically%29&doctype=Inline&group=0

网友答案:

A doctype is required in today's modern web pages. Without one, you are in quirks mode and, IE in particular, will struggle to present your page properly. You never want to be in quirks mode.

Remove your conditional comments and present that doctype to all browsers all the time on all web pages to remain in standards mode. Do NOT use IE as a reference for how things should work.

Write your markup as you think it should be done, validate it, then look to see if it works as you wish in all the browsers. You will have more problems with IE than the others but IE is most likely wrong.

分享给朋友:
您可能感兴趣的文章:
随机阅读: