HTML <meta>
Anonymous contributor
Published Jun 20, 2021Updated Jul 1, 2022
Contribute to Docs
The <meta> element represents an interface to provide metadata pertaining to the document. Metadata is data that is used to describe the document that contains it. The <meta> element must be placed inside the <head> element of the document.
Syntax
<meta />
The <meta> element that has no closing tag, meaning that it cannot have elements inside of it. It uses attributes to set properties, some common attributes are:
charset: describes the character encoding used when writing the documentname: describes the type of meta tag, may include things like"author","description","keywords", and"color-scheme"content: accompaniesnameto provide the appropriate content specific to the value ofname.
Example
<html><head><!-- Sets the character set used to create this HTML file --><meta charset="utf-8" /><!-- Details the author of the document --><meta name="author" content="Jasmine the Gorilla" /><!-- Provides a description used to improve discovery in search engines --><metaname="description"content="A short fable about the origin of bananas, and the joy they provide."/><!-- Sets the color scheme to dark if possible, but lets the browser know that light will render correctly, too --><meta name="color-scheme" content="dark light" /></head><body></body></html>
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn HTML on Codecademy
- Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
- Includes 34 Courses
- With Professional Certification
- Beginner Friendly.115 hours
- Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
- Beginner Friendly.7 hours