HTML !DOCTYPE Declaration: Definition, Syntax & Example
what is <!DOCTYPE> declaration in html
✅ What is <!DOCTYPE> in HTML
1) The <!DOCTYPE> declaration in HTML is used to tell the web browser which version of HTML the webpage is written in. It is always placed at the top of the document and helps the browser display the page properly.
2) In modern websites, the most commonly used declaration is:
<!DOCTYPE html>
3) This represents HTML5, the latest version of HTML. Compared to older versions, HTML5 uses a simple and easy DOCTYPE.
4) The main purpose of <!DOCTYPE> is to make sure the browser uses standard mode when rendering the page. If this declaration is missing, the browser may switch to quirks mode, which can cause design issues and inconsistent layouts. Standard mode ensures that HTML and CSS work correctly across different browsers.
5) It is also important to understand that <!DOCTYPE> is not an HTML element, but just a declaration, so it does not need a closing tag.
6) In older versions like HTML4 and XHTML, the DOCTYPE declaration was long and complicated. However, HTML5 made it much simpler and easier to use.
2) In modern websites, the most commonly used declaration is:
<!DOCTYPE html>
3) This represents HTML5, the latest version of HTML. Compared to older versions, HTML5 uses a simple and easy DOCTYPE.
4) The main purpose of <!DOCTYPE> is to make sure the browser uses standard mode when rendering the page. If this declaration is missing, the browser may switch to quirks mode, which can cause design issues and inconsistent layouts. Standard mode ensures that HTML and CSS work correctly across different browsers.
5) It is also important to understand that <!DOCTYPE> is not an HTML element, but just a declaration, so it does not need a closing tag.
6) In older versions like HTML4 and XHTML, the DOCTYPE declaration was long and complicated. However, HTML5 made it much simpler and easier to use.
Why <!Doctype> important
- Avoid browser errors
- Enable standards mode
- Displayed the webpage Correctly
- Understand the HTML version
Syntax
what is doctype declaration in html
Example
what is doctype declaration in html
Explain Program
Step 1 ]
<!DOCTYPE html>
This declare the document type.
browser that the document is written in html
Step 2 ]
<html>.... . </html>
html is the root element of the html page.
Every thing inside it is part of the webpage.
Step 3]
<head>.....</head>
head section contain metadata about the webpage information
for the browser not display on the webpage.
Step 4]
<title> Title of the webdesigningtheory.blogspot.com </title>
title tag set title of the webpage
on the browser tag
search engine results.
Step 5]
body section contains content that will be displayed on the webpage.
Body section contains content plain text that will appear on the page.
<br>
<br> tag use create line break.
Step 6 ]
closing the Tag
what is doctype declaration in html
Post a Comment