The META element lives inside the head element and contains information about that webpage. It is not visible to users but fulfills a number of purposes such as telling search engines about your page, who created it, and whether or not it is time-sensitive.
The meta element is an empty element, like the upcoming link element. The most common attributes are ‘name’ and ‘content’. These attributes are often used together and specify the properties of the entire page:
- The value of the name attribute is the property you are setting.
- The value of the content attribute is the value that you want to give to this property.
For example, on the second meta line below, the name attribute indicates an intention to specify a description for the page. The content attribute is where this description is actually specified. The value of the name attribute can be anything you want it to be.
We will look at the Meta element more later. For the time being however, you should include the following meta elements in your pages:
- charset - This define the character set to use for page display. To display an HTML page correctly, a web browser must know which character set (character encoding) to use. UTF-8 (Unicode) covers almost all of the characters and symbols in the world. This includes the original ASCII standard that covers most of the character symbols you use.
- Description - This contains a description of the page. This description is commonly used by search engines to understand what the page is about. As such, it should be less than 155 characters.
- Author - This defines the author of the webpage.
Note The charset attribute is usually the first element in the head.
<!DOCTYPE html> <html> <head> <!-- Define the character set used: --> <meta charset="UTF-8"> <!-- Provide a description of your page: --> <meta name="description" content="A short description..."> <!-- Provide the author information for the page: --> <meta name="author" content="Your Name"> </head> </html>