DEV Community

Cover image for What is a meta tag in HTML?
johar ali
johar ali

Posted on

What is a meta tag in HTML?

Meta tags in HTML are text snippets in the form of data, the job of meta tags is to show the content of your page. Meta tags and their value do not appear on the web page you create. Meta tags can be easily viewed in the source code of an HTML page. Meta tags act as small content descriptors, their main function is to allow search engines to tell what your web page is about and what keywords it contains.

<meta charset="UTF-8">: Specifies the character encoding for the document. UTF-8 is a widely used encoding that supports a wide range of characters and symbols.

<meta name="viewport" content="width=device-width, initial-scale=1.0">: Defines the viewport settings for responsive web design. It helps control how the page is displayed on different devices and screen sizes.

<meta name="description" content="A brief description of the page content">: Provides a concise description of the web page's content. This description is often used by search engines in search results.

<meta name="keywords" content="keyword1, keyword2, keyword3">: Specifies a comma-separated list of keywords or phrases that are relevant to the content of the page. While less important for SEO than in the past, some search engines may still consider these keywords.

<meta name="author" content="Author Name">: Indicates the author of the web page's content.

<meta name="viewport" content="width=device-width, initial-scale=1.0">: This meta tag is commonly used for responsive web design. It instructs the browser to set the initial zoom level and width of the page to match the device's screen width.
Enter fullscreen mode Exit fullscreen mode

These are just a few examples of HTML meta tags. They serve various purposes, from providing information to search engines to controlling the appearance and behavior of web pages. Web developers often use a combination of these tags to optimize their websites for both users and search engines.

Top comments (0)