Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5: Meta charset before title?

Tags:

html

I often see this:

<head>
<meta charset="utf-8">
<title>Title</title>
...
</head>

Is it important to put the chartset definition BEFORE the the title tag?

Thanks!

like image 657
WeekendCoder Avatar asked Jun 06 '15 11:06

WeekendCoder


1 Answers

yes it is, see https://code.google.com/p/doctype-mirror/wiki/MetaCharsetAttribute

In order for all browsers to recognize a <meta charset> declaration, it must be

  • Within the <head> element,
  • Before any elements that contain text, such as the <title> element, AND
  • Within the first 512 bytes of your document, including DOCTYPE and whitespace
like image 133
mnagel Avatar answered Oct 12 '22 03:10

mnagel