下面的文章提供了 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中文網其他相關文章!