Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we need the meta content type tag in HTML head?

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>
like image 999
Hemant Kumar Avatar asked Dec 28 '10 06:12

Hemant Kumar


People also ask

What is the purpose of meta tags in HTML head area?

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.

Do meta tags need to be in head?

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.

Why do we need meta tags?

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.


2 Answers

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.

alt text

like image 147
BalusC Avatar answered Sep 26 '22 06:09

BalusC


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:

  • Meta Tags Explained
like image 27
Sarfraz Avatar answered Sep 26 '22 06:09

Sarfraz