Why do we need to include the meta content type tag in HTML head like this?
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
Definition and Usage The <meta> tag defines metadata about an HTML document. Metadata is data (information) about data. <meta> tags always go inside the <head> element, and are typically used to specify character set, page description, keywords, author of the document, and viewport settings.
01. META tags are only allowed within HEAD (just like, say, TITLE) so by putting it into a BODY, you're essentially creating an invalid markup.
Meta tags are the first impression someone has of your page on a SERP. A good meta description will attract users to click through and visit your site. They ensure that search engines know what your content is about, so they'll be able to show the website in the appropriate results.
Whenever the webpage is been opened locally (from disk file system), the text/html
part will instruct the webbrowser of which type the document is so that it knows how to parse it and the charset=UTF-8
will instruct the webbrowser which character encoding should be used to display the characters on the webpage so that it won't use the platform default encoding (which may not necessarily be the right one which would thus potentially end up as mojibake).
Important detail is that this HTML meta header isn't been used when the page is served over the web by HTTP. Instead, the Content-Type
one in the HTTP response header will be used. So if this lacks the charset=UTF-8
part while the content is actually decoded as UTF-8, then it will likely go mojibake. You can determine the Content-Type
header with for example Firebug, in the Net panel.
Meta elements are typically used to specify page description, keywords, author of the document, last modified, and other metadata.
The meta tag you have posted, will instruct the browser to have text/html
type of document with character set or language set to UTF-8
.
Used to declare the character set.
The Meta Content Type tag is used to declare the character set of a website. It has become recommended to always use the Meta Content Type tag even if you use a DTD declaration above the Header. If you fail to do so, it may cause display problems. For instance, the document may use UTF-8 punctuation characters but is displayed in ISO or ASCII character sets. There are other benefits to using the Meta Content Type tag. Simply subscribe to our SEO Revolution Newsletter (nominal fee membership) to get the entire scoop of what the Meta Content Type tag can do for your site
See this for more info:
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