Thursday, 9 March 2017

Document Structure in HTML5

If you are creating an HTML5 document, then the document structure should be as given below :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>
.................
</title>
........
</head>
<body>
.................
</body>
</html>
If you compare HTML5's document structure with earlier given HTML document structure, you'll notice certain changes, like :
  • Additional <!DOCTYPE html> tag
  • Different way of using <HTML> tag
  • Additional <meta charset...>tag
  • All other tags are similar.
The DOCTYPE declaration must be at the top of the document. the DOCTYPE is not an version of HTML element, even though it loks a bit like it.The DOCTYPE tells the browser what version of HTML that is used in the document.
The HTML tag similar to earlier discussed HTML tag although here the language English as been specified as attribute of HTML Tag, lang="en". you may even skip lang attribute.

META charset:
                         META tag's charset attribute is given to specify the character encoding used. by default for English pages, the  UTF-8 character encoding is used , which is specified through it.

No comments:

Post a Comment