HTML Meta Information
Meta tags in HTML documents provide useful information about the document including a description, keywords, author, dates of modifications and around 90 other fields. This topic covers the usage and purpose of these tags.
Giving the name of the Web application that the page represents.
If it’s not a Web application, the application-name meta tag must not be used.
Set the author of the page:
Only one name can be given.
Set the description of the page:
The description meta-tag can be used by various search engines while indexing your web page for searching purpose. Usually, the description contained within the meta tag is the short summary that shows up under the page/website's main title in the search engine results. Google usually uses only the first 20-25 words of your description.
Identifies one of the software packages used to generate the document. Only to be used for pages where the markup is automatically generated.
Set keywords for search engines (comma-separated):
The keywords meta tag is sometimes used by search engines to know the search query which is relevant to your web page. As a rule of thumb, it is probably a good idea to not add too many words, as most search engines that use this meta tag for indexing will only index the first ~20 words. Make sure that you put the most important keywords first.
The charset attribute specifies the character encoding for the HTML document and needs to be a valid character encoding (examples include windows-1252, ISO-8859-2, Shift_JIS, and UTF-8). UTF-8 (Unicode) is the most widely used and should be used for any new project.
Version = 5
All browsers have always recognized the <meta charset> form, but if you for some reason need your page to be valid HTML 4.01, you can use the following instead:
See also the Encoding Standard, to view all available character encoding labels that browsers recognize.
The robots attribute, supported by several major search engines, controls whether search engine spiders are allowed to index a page or not and whether they should follow links from a page or not.
This example instructs all search engines do not to show the page in search results. Other allowed values are:
|all||Default. Equivalent to index, follow. See note below.|
|noindex||Do not index the page at all.|
|nofollow||Do not follow the links on this page any|
|Equivalent to noindex, nofollow.|
|noarchive||Do not make a cached version of this page available in search results.|
|nocache||Synonym of noarchive used by some bots such as Bing.|
|nosnippet||Do not show a snippet of this page in search results.|
|noodp||Do not use metadata of this page from the Open Directory Project for titles or snippets in search results.|
|notranslate||Do not offer translations of this page in search results|
|noimageindex||Do not index images on this page.|
|unavailable_after [RFC-850 date/time]||Do not show this page in search results after the specified date/time. The date/time must be specified in the RFC 850 format.|
|follow||The links on the page can be followed. See note below.|
Note: Explicitly defining index and/or follow, while valid values, is not necessary as pretty much all search engines will assume they are allowed to do so if not explicitly prevented from doing so. Similar to how the robots.txt file operates, search engines generally only look for things they are not allowed to do. Only stating things a search engine isn't allowed to do also prevents accidentally stating opposites (such as index, ..., noindex) which not all search engines will treat in the same way.
Social Media in meta tags
Open Graph is a standard for metadata that extends the normal information contained within a site's head markup. This enables websites such as Facebook to display deeper and richer information about a website in a structured format. This information is then automatically displayed when users share links to websites containing OG metadata on Facebook.
Facebook / Open Graph
Facebook / Instant Articles
Twitter uses its own markup for metadata. This metadata is used as information to control how tweets are displayed when they contain a link to the site.
Google+ / Schema.org
Mobile Layout Control using meta tags
Common mobile-optimized sites use the <meta name="viewport"> tag like this:
The viewport element gives the browser instructions on how to control the page's dimensions and scaling based on the device you are using.
In the above example, content="width=device-width means that the browser will render the width of the page at the width of its own screen. So if that screen is 480px wide, the browser window will be 480px wide. initialscale=1 depicts that the initial zoom (which is 1 in this case, means it does not zoom).
Below are the attributes this tag supports:
|width||The width of the virtual viewport of the device. Values1: device-width or the actual width in pixels, like 480|
|height||The height of the virtual viewport of the device. Values2: device-height or the actual width in pixels, like 600|
|initial-scale||The initial zoom when the page is loaded. 1.0 does not zoom.|
|minimum scale||The minimum amount the visitor can zoom on the page. 1.0 does not zoom.|
|maximum scale||The maximum amount the visitor can zoom on the page. 1.0 does not zoom.|
|user-scalable||Allows the device to zoom in and out. Values are yes or no. If set to no, the user is not able to zoom in the webpage. The default is yes. Browser settings can ignore this rule.|
- 1 The width property can be either specified in pixels (width=600) or by device-width (width=device-width) which represents the physical width of the device's screen.
- 2 Similarly, the height property can be either specified in pixels (height=600) or by device-height (height=device-height) which represents the physical height of the device's screen.
Automatic Refresh using meta tag
To refresh the page every five seconds, add this meta element in the head element:
CAUTION! While this is a valid command, it is recommended that you do not use it because of its negative effects on user experience. Refreshing the page too often can cause it to become unresponsive, and often scrolls to the top of the page. If some information on the page needs to be updated continuously, there are much better ways to do that by only refreshing a portion of a page.
Phone Number Recognition
Mobile platforms like iOS automatically recognize phone numbers and turn them into tel: links. While the feature is very practical, the system sometimes detects ISBN codes and other numbers as telephone numbers.
For mobile Safari and some other WebKit-based mobile browsers to turn off automatic phone number recognition and formatting, you need this meta tag:
Automatic redirect using meta tags
Sometimes your webpage needs an automatic redirect.
For example, to redirect to example.com after 5 seconds:
This is line will send you to the designated website (in this case example.com after 5 seconds. If you need to change the time delay before a redirect, simply changing the number right before your;url= will alter the time delay.
You can set up your web app or website to have an application shortcut icon added to a device's home screen, and have the app launch in full-screen "app mode" using Chrome for Android’s "Add to Home screen" menu item.
Below meta tag(s) will open web app in full-screen mode (without address bar).
You can also set color for status bar and address bar in meta tag.
Meta tags code example
ATutorialHub Related Guide
HTML Tutorials Comments (8)
panduranga gupta2021-07-05 07:03:13
good website for learning and help me a lot
The awsome website i am looking like for a long time, good work atutorialhub team keep doing
Learning a lot from the courses present on atutorialhub. The courses are very well explained. Great experience
It is very helpful to students and easy to learn the concepts
Great job Tutorials are easy to understand Please make use of it
Zain Khan2021-09-18 15:07:23
Great content and customized courses.
Rudrakshi Bhatt2021-09-09 15:08:10
Well structured coursed and explained really well!
Pavana Somashekar2021-09-11 15:09:08
Good platform for beginners and learn a lot on this website