Leena-D
Leena-D

Reputation: 43

Are multiple <meta> tags required or do I only need one?

I'm pretty new to coding and I wanted to try out creating a website on my own. I'm just not too sure about how to use meta tags. Can I put all the attributes I want to use in one tag, are multiple required or does the amount depend on which attributes I plan to use?

I've read a little of the documentation here: https://www.w3.org/TR/2014/REC-html5-20141028/document-metadata.html#the-meta-element, and a couple questions on this site but I still don't have a clear understanding of how many to use.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Home</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <link type="text/css" rel="stylesheet" href="standard-theme.css" />
</head>

I just want a clear understanding of how many meta tags should be used in my document. Any help is greatly appreciated.

Upvotes: 4

Views: 2418

Answers (2)

Webber
Webber

Reputation: 5504

Meta tags describe the meta of your page

It tells the browser, screen readers and search engines how to interpret your page, what kind of information to expect and how it should work on mobile phones, among other things.

Mozilla has some good documentation about the <meta /> tag. Have a lookt at the possible properties and their values to get a better understanding.

Some interesting things to note:

  • Multiple meta tags can be used.
  • The charset property declares the character encoding of the page
  • The name property can be used together with the content property.

Each meta tag describes a separate meta property of the page. Most meta properties are identified by the name=<propertyName> part, which you can NOT pass multiple times.

Common examples:

  • <meta charset="utf-8" />
  • <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
  • <meta name="theme-color" content="#000000" />
  • <meta name="description" content="This page contains information about X and Y" />

Upvotes: 2

pasanjg
pasanjg

Reputation: 646

<meta> tag gives the specific information about the html document. You have to use multiple tags describe each metadata you use in the document depending on the requirement. ex: page description, keywords, author of the document, last modified, etc

<meta> has multiple uses and you can find more information on W3Schools here

Upvotes: 0

Related Questions