Answers

Question and Answer:

  Home  HTML Developer

⟩ Explain me how do you indicate the character set being used by an HTML5 document? How does this differ from older HTML standards?

In HTML5, the encoding used can be indicated with the charset attribute of a <meta> tag inside the document’s <head> element:

<!DOCTYPE html>

<html>

<head>

...

<meta charset="UTF-8">

...

</head>

...

</html>

This is a slightly simpler syntax from older HTML standards, which did not have the charset attribute. For example, an HTML 4.01 document would use the <meta> tag as follows:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>

<head>

...

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

...

</head>

...

</html>

 170 views

More Questions for you: