I'm getting an HTML validation error for the following line, I'm not sure where I should specify my charset if I don't do it within the meta tag.
Line 5, Column 70: Attribute charset not allowed on element meta at this point.
<meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
It needs to be inside the <head> element and within the first 1024 bytes of the HTML, as some browsers only look at those bytes before choosing an encoding.
Furthermore, most browsers use UTF-8 by default if no character encoding is specified. But because that's not guaranteed, it's better to just include a character encoding specification using the <meta> tag in your HTML file. There you have it.
DOCTYPE html>, the charset defaults to UTF-8. This is usually the desired setting making the meta charset setting unnecessary.
It is not necessary to include <meta charset="blah"> . As the specification says, the character set may also be specified by the server using the HTTP Content-Type header or by including a Unicode BOM at the beginning of the downloaded file.
This is because you put it in a Content-type
meta tag, this is not allowed.
simply make a seperate meta tag, e.g.
<meta charset="utf-8" />
this should validate for you.
Yes. You should use as this is recommended in html5 and it is a new recommendation.
Below is a simple html5 layout:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Title of the document</title>
</head>
<body>
Content of the document......
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With