Webdesign的DOCTYPE声明 [英] DOCTYPE declaration for Webdesign

查看:76
本文介绍了Webdesign的DOCTYPE声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在设计一个包含HTML,CSS和JQuery的网站。我没有使用HTML5。

我的Dreamweaver应用程序自动添加了这样的DOCTYPE。



 <   !DOCTYPE     html    < span class =code-attribute> PUBLIC     -  // W3C // DTD     XHTML     1.0     Transitional // EN   http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd >  





我不知道这是否是我应该使用的正确DOCTYPE。我可以避免它,并声明像HTML5? <!DOCTYPE HTML>

解决方案

与任何语言一样,HTML5具有语法和词汇。 
语法
< !DOCTYPE html > 位于每个HTML5页面的顶部。
词汇
HTML5字< !DOCTYPE html > 表示此页面是用HTML5编写的而不是到,说HTML 4.01。
为什么,你问,不要只写< HTML5 > 甚至是一个兴致勃勃的< !HTML5 > ?我完全不知道。它仍然比以前更好。以下是一种常见类型的XHTML示例:
< !DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd >
希望HTML5中的doctype声明不会变成它对XHTML和以前版本的HTML所做的疯狂混乱。负责此类事情的人说它不会,但时间会证明。
所以现在你学到了三件事:
如何查看页面的源代码,这是一个重要的工具。
你知道HTML5中的一个词:< !DOCTYPE html > =HTML5
和一条语法规则:< !DOCTYPE html > 位于每个页面的顶部。





定义和用法
< !DOCTYPE > 声明必须是HTML文档中的第一件事,在< <之前/ span> html > 标记。

< !DOCTYPE > 声明不是HTML标记;它是向Web浏览器指示页面的HTML版本。

在HTML 4.01中,< !DOCTYPE > 声明是指DTD,因为HTML 4.01基于SGML。 DTD指定标记语言的规则,以便浏览器正确呈现内容。

HTML5不基于SGML,因此不需要引用DTD。

提示:始终添加< !DOCTYPE > 声明HTML文档,以便浏览器知道所期望的文档类型。







参考

http://www.w3schools。 com / tags / tag_DOCTYPE.asp [ ^ ]

http://www.html-5-tutorial.com/doctype.htm [ ^ ]

https://msdn.microsoft.com/en -us / library / ie / ms535242(v = vs.85).aspx [ ^ ]

Hi,
I am designing a website with HTML, CSS, and JQuery. I am not using HTML5.
My dreamweaver application has automatically added a DOCTYPE like this.

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



I don't know whether this is the right DOCTYPE which I should use. Can I avoid it, and declare like HTML5 ? <!DOCTYPE HTML>

解决方案

Like any language, HTML5 has a grammar and a vocabulary.
Grammar
<!DOCTYPE html> goes at the top of every HTML5 page.
Vocabulary
The HTML5 word <!DOCTYPE html> means "this page is written in HTML5" as opposed to, say HTML 4.01.
Why, you ask, don't they just write <HTML5> or even a zesty <!HTML5>? I have absolutely no idea. Still it's better than what they had before. Here's an example of one common type of XHTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Hopefully the doctype declaration in HTML5 won't turn into the crazy mess it did with XHTML and previous versions of HTML. Those in charge of such things say it won't, but time will tell.
So now you learned three things:
How to view the source code of a page, an important tool.
You know one word in HTML5: <!DOCTYPE html> = "HTML5"
and one grammar rule: <!DOCTYPE html> goes at the top of every page.



Definition and Usage
The <!DOCTYPE> declaration must be the very first thing in your HTML document, before the <html> tag.

The <!DOCTYPE> declaration is not an HTML tag; it is an instruction to the web browser about what version of HTML the page is written in.

In HTML 4.01, the <!DOCTYPE> declaration refers to a DTD, because HTML 4.01 was based on SGML. The DTD specifies the rules for the markup language, so that the browsers render the content correctly.

HTML5 is not based on SGML, and therefore does not require a reference to a DTD.

Tip: Always add the <!DOCTYPE> declaration to your HTML documents, so that the browser knows what type of document to expect.




Ref.
http://www.w3schools.com/tags/tag_DOCTYPE.asp[^]
http://www.html-5-tutorial.com/doctype.htm[^]
https://msdn.microsoft.com/en-us/library/ie/ms535242(v=vs.85).aspx[^]


这篇关于Webdesign的DOCTYPE声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆