下面的文章提供了 DOCTYPE HTML 的概述。在 html 文档类型中,用于声明用户指令,并使用 html、xml 编码本身等标记语言将数据转换为 Web 浏览器。我们已将文档类型声明为文档的初始步骤。一般来说,DOCTYPE 不考虑任何标签、元素或属性;它有助于识别标记语言的版本。 tag 是 html 标记语言的根标签或元素。它还有助于存储和保存所有的网页内容,并且它会告诉用户浏览器识别它是否是 html 语言,但使用
语法:
当我们使用 HTML 或任何标记语言时,每个标签和元素都有一组语法,与文档类型声明中相同。
下面是声明
<!DOCTYPE html> <html> <head> </head> <body> ---Some Front End logic ,codes,tags,elements--- </body> </html>
以下是示例:
代码:
<!DOCTYPE html> <html> <head> <title>Sample</title> </head> <body> <p>Welcome To My Domain </p> </body> </html>
输出:
代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title> Sample Example for Strict DTD </title> </head> <body> <a href><h1>Please Click </h1></a> <marquee> Welcome To My Domain </marquee> </body> </html>
输出:
代码:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <title> Frameset DTD Example </title> </head> <frameset cols="23%,*,43%"> <frame src="first.html"> <frame src="second.html"> <frame src="third.html"> </frameset> </html>
Output:
In the above set of examples, we will see the sample and basic dtd usages in html. In the first example, we use the that is come under the html5 version. So we use normal and basic html codings. In the second example, we use strict dtd in html 4 version so it will accept the particular tags and elements; it will not be allowed to use the deprecated tag elements in the second example, but in the last example, we use the frameset dtd in the html documents it allows the deprecated elements as well as whatever we use the html 4 transitional dtd elements and also will include the frameset tag elements.
In html will use DOCTYPE as a better choice for creating the web-based applications, and also it will be helpful for the website users browsers that the document is related to the html based documents. If we suppose will not use the html tag elements in the inside of the document that should be with the DOCTYPE declaration, it must be must with the html standards with the help of web browsers, and templates will check the html standards.
以上是文档类型 HTML的详细内容。更多信息请关注PHP中文网其他相关文章!