When we create a website, we usually focus on headings, paragraphs, images, and colors. But did you know that there is also some important information that users may not see directly on the webpage?
This information is often provided through meta tags in HTML.
In this document, let's understand what meta tags are, why we use them, and how they work with some simple examples.
What Are Meta Tags in HTML?
Meta tags are HTML elements that provide information about a webpage. This information is called metadata.
Metadata can tell the browser about the character encoding, page description, viewport settings, and other details.
Meta tags are usually written inside the <head> section of an HTML document.
Basic Example of Meta Tags
Here is a simple example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<meta name="description"
content="Learn HTML meta tags with simple examples.">
<title>HTML Meta Tags</title>
</head>
<body>
<h1>Welcome to My Website!</h1>
<p>This is my first webpage.</p>
</body>
</html>
Let's understand what each meta tag does.
<meta charset="UTF-8">
This tag tells the browser which character encoding to use.
UTF-8 supports many languages, symbols, and special characters. It helps text display correctly on a webpage.
<meta name="viewport" content="width=device-width, initial-scale=1.0">

This tag helps a webpage display properly on different screen sizes, including mobile phones, tablets, and computers.
If you are building a responsive website, this meta tag is very important.