HTML5仅在某些浏览器上使用错误的doctype

时间:2022-11-12 00:25:49

Because everyone is talking about HTML5 I decided to create a website using HTML5 yesterday. On Chrome and Desktop PC is looks fine on notebooks and netbooks too but then I tested on a Samsung S4 and got a very bad looking website using Chrome and then Opera (both for Android) Then I changed the doctype from HTML5 to 4.1 strict but nothing more and uploaded a copy of the same website and it started to look good again on Chrome and 1 opera version (not the new mini)

因为每个人都在谈论HTML5,所以我决定昨天使用HTML5创建一个网站。在Chrome和台式电脑上看起来也很好用于笔记本电脑和上网本,但后来我在三星S4上测试了一个非常糟糕的网站使用Chrome和Opera(两者都用于Android)然后我将doctype从HTML5改为4.1严格但没有更多并上传了同一个网站的副本,它开始在Chrome和1个歌剧版本(不是新的迷你版)上再次看起来不错

Questions:

问题:

How can it be possible that a website using HTML5 is not recognized by some browsers with it's doctype but changing to older doctype it works fine?

如何使用HTML5的网站不被某些浏览器识别,而是更改为较旧的doctype,它可以正常工作吗?

What do you recommend for doctype in this case so I have multi browser compatibility because HTML5 is not really 100% ready for all browsers...

在这种情况下你对doctype有什么推荐,所以我有多浏览器兼容性,因为HTML5并不是100%准备好适用于所有浏览器......

Last but not least: You remember I wrote about yesterday my website was looking bad because of the doctype, well today the same page with the HTML doctype is working fine on Chrome for android again? So yesterday it did not and now it does?

最后但并非最不重要的一点:你记得我昨天写过我的网站看起来很糟糕因为doctype,今天同样的HTML doctype页面在Chrome for Android上工作得很好吗?所以昨天它没有,现在呢?

Can it be cache from the copy I uploaded but using 4.1 strict doctype?

可以从我上传的副本缓存但是使用4.1严格的doctype吗?

Here is the doctype I have right now

这是我现在的doctype

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

1 个解决方案

#1


1  

Use the following doctype

使用以下doctype

<!DOCTYPE html>

Html 4.x was based on SMGL (http://nl.wikipedia.org/wiki/Standard_Generalized_Markup_Language) HTML 5 does not need DTD ( Document Type Definition) so you can just use that simple tag to define how browsers should render your website. You are correct that not all browsers interp HTML5 100%, but it is more then enough supported to just say that your page is HTML5.

Html 4.x基于SMGL(http://nl.wikipedia.org/wiki/Standard_Generalized_Markup_Language)HTML 5不需要DTD(文档类型定义),因此您可以使用该简单标记来定义浏览器应如何呈现您的网站。你是对的,并非所有的浏览器都是100%的HTML5,但是只要说你的页面是HTML5就足够了。

On your first question: I would need examples. Although I might can understand that the browser does not really 'understands' the 'old' doctype and just sort of ignores it and sees it as HTML5. See my above text which MIGHT have to do with it.

关于你的第一个问题:我需要一些例子。虽然我可能会理解浏览器并不真正“理解”'旧的'doctype而只是忽略它并将其视为HTML5。请参阅我的上述文本可能与它有关。

Your last question; yes this could very be a cached copy!

你的上一个问题;是的,这可能是一个缓存副本!

#1


1  

Use the following doctype

使用以下doctype

<!DOCTYPE html>

Html 4.x was based on SMGL (http://nl.wikipedia.org/wiki/Standard_Generalized_Markup_Language) HTML 5 does not need DTD ( Document Type Definition) so you can just use that simple tag to define how browsers should render your website. You are correct that not all browsers interp HTML5 100%, but it is more then enough supported to just say that your page is HTML5.

Html 4.x基于SMGL(http://nl.wikipedia.org/wiki/Standard_Generalized_Markup_Language)HTML 5不需要DTD(文档类型定义),因此您可以使用该简单标记来定义浏览器应如何呈现您的网站。你是对的,并非所有的浏览器都是100%的HTML5,但是只要说你的页面是HTML5就足够了。

On your first question: I would need examples. Although I might can understand that the browser does not really 'understands' the 'old' doctype and just sort of ignores it and sees it as HTML5. See my above text which MIGHT have to do with it.

关于你的第一个问题:我需要一些例子。虽然我可能会理解浏览器并不真正“理解”'旧的'doctype而只是忽略它并将其视为HTML5。请参阅我的上述文本可能与它有关。

Your last question; yes this could very be a cached copy!

你的上一个问题;是的,这可能是一个缓存副本!