Introduction to <meta>tag

The <meta>tag in HTML is an essential element used to provide metadata about a webpage. Metadata is information about the data on the webpage and is not typically displayed to the user. Instead, it serves several behind-the-scenes purposes, primarily benefiting web browsers, search engines, and other services that interact with the webpage.

Copy to clipboard

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <!-- Basic Meta Tags -->
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <meta name="description" content="A beautifully designed HTML document with various styled elements using advanced CSS techniques.">
      <meta name="keywords" content="HTML, CSS, web design, UI, UX, modern elements">
      <meta name="author" content="Your Name">
    
      <!-- Open Graph Meta Tags for Social Media -->
      <meta property="og:title" content="Beautiful HTML Element Designs">
      <meta property="og:description" content="Explore a collection of beautifully styled HTML elements with CSS.">
      <meta property="og:image" content="example-image.jpg">
    
      <!-- Title of the Page -->
      <title>Beautiful HTML Element Designs</title>
    
      <!-- Link to External Stylesheet -->
      <link rel="stylesheet" href="styles.css">
    
      <!-- Favicon -->
      <link rel="icon" href="favicon.ico" type="image/x-icon">
    
      <!-- Google Fonts Link -->
      <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
      
      <!-- Preconnect for Performance Optimization -->
      <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    </head>
    <body>
    
      <!-- Header Section -->
      <header>
        <h1>Welcome to the Example Page</h1>
      </header>
    
      <!-- Main Content Section -->
      <main>
        <!-- Example for <hgroup> -->
        <section class="custom-section">
          <hgroup class="custom-hgroup">
            <h1>Main Heading of the Section</h1>
            <h2>Subheading or Subtitle that Describes the Content Below</h2>
          </hgroup>
          <p>This section provides detailed information about the topic covered in the heading above.</p>
          
          <!-- Horizontal Rule -->
          <hr class="custom-hr">
    
          <h2>Front-End Development</h2>
          <p>Front-end development is the practice of producing HTML, CSS, and JavaScript for a website or web application so that a user can see and interact with them directly.</p>
        </section>
    
        <!-- Example for <i> -->
        <p>When writing in academic settings, it's common to use Latin terms like <i class="custom-italic">et al.</i> to refer to multiple authors without listing them all.</p>
    
        <!-- Example for <iframe> -->
        <div class="iframe-container">
          <iframe class="custom-iframe" src="https://www.example.com" title="Embedded Example Website"></iframe>
        </div>
    
        <!-- Example for <map> and <area> -->
        <img src="world-map.jpg" alt="World Map" usemap="#worldmap" class="custom-image-map">
        <map name="worldmap">
          <area shape="rect" coords="34,44,270,350" alt="North America" href="https://example.com/north-america">
          <area shape="circle" coords="337,300,44" alt="South America" href="https://example.com/south-america">
          <area shape="poly" coords="220,120,230,140,260,140,270,120" alt="Europe" href="https://example.com/europe">
        </map>
    
        <!-- Additional content and examples -->
        <p>This is an example of using the <code><link></code> tag to load external resources.</p>
    
        <!-- Button Example -->
        <a href="#" class="custom-button">Click Me</a>
    
      </main>
    
      <!-- Footer Section -->
      <footer class="custom-footer">
        <p>&copy; 2024 Your Company Name. All rights reserved.</p>
        <nav class="footer-nav">
          <a href="#">Privacy Policy</a> | 
          <a href="#">Terms of Service</a> | 
          <a href="#">Contact Us</a>
        </nav>
      </footer>
    
    </body>
    </html>
Copy to clipboard
/* General Styles */
    body {
        font-family: 'Roboto', sans-serif;
        background: linear-gradient(120deg, #f0f0f0, #ffffff);
        color: #333;
        margin: 0;
        padding: 0;
        line-height: 1.6;
    }
    
    /* Header Styling */
    header {
        background: linear-gradient(to right, #5cb85c, #4cae4c);
        color: white;
        padding: 40px 20px;
        text-align: center;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    }
    
    header h1 {
        margin: 0;
        font-size: 3rem;
        font-weight: 700;
        letter-spacing: 2px;
        text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    }
    
    /* Main Content */
    main {
        padding: 30px;
        max-width: 900px;
        margin: 40px auto;
        background-color: white;
        border-radius: 12px;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease;
    }
    
    main:hover {
        transform: translateY(-10px);
    }
    
    main p {
        font-size: 1.2rem;
        color: #555;
        margin-bottom: 20px;
    }
    
    /* Hgroup Styling */
    .custom-hgroup {
        margin-bottom: 30px;
        text-align: center;
    }
    
    .custom-hgroup h1 {
        font-size: 2.5rem;
        margin: 0;
        color: #333;
    }
    
    .custom-hgroup h2 {
        font-size: 1.5rem;
        margin: 0;
        color: #666;
        font-weight: 300;
    }
    
    /* HR Styling */
    .custom-hr {
        border: none;
        height: 3px;
        background-image: linear-gradient(to right, #5cb85c, #f0ad4e);
        margin: 30px 0;
        border-radius: 3px;
    }
    
    /* Italic Text Styling */
    .custom-italic {
        font-style: italic;
        color: #5cb85c;
        background-color: #e8f5e9;
        padding: 4px 8px;
        border-radius: 5px;
        transition: background-color 0.3s ease;
    }
    
    .custom-italic:hover {
        background-color: #d0f0d0;
    }
    
    /* Iframe Styling */
    .iframe-container {
        position: relative;
        width: 100%;
        padding-bottom: 56.25%; /* 16:9 aspect ratio */
        height: 0;
        overflow: hidden;
        border-radius: 12px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
        margin: 30px 0;
    }
    
    .custom-iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        border: none;
        border-radius: 12px;
    }
    
    /* Image Map Styling */
    .custom-image-map {
        width: 100%;
        height: auto;
        display: block;
        margin: 30px auto;
        border: 3px solid #ddd;
        border-radius: 12px;
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }
    
    .custom-image-map:hover {
        border-color: #5cb85c;
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    }
    
    /* Button Styling */
    .custom-button {
        display: inline-block;
        padding: 15px 30px;
        margin: 20px 0;
        background-color: #5cb85c;
        color: #fff;
        font-size: 1.2rem;
        text-align: center;
        text-decoration: none;
        border-radius: 8px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    }
    
    .custom-button:hover {
        background-color: #4cae4c;
        box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
        transform: translateY(-3px);
    }
    
    /* Footer Styling */
    .custom-footer {
        background-color: #333;
        color: #fff;
        text-align: center;
        padding: 20px;
        margin-top: 40px;
        position: relative;
        width: 100%;
        bottom: 0;
        box-shadow: 0 -8px 16px rgba(0, 0, 0, 0.1);
    }
    
    .footer-nav a {
        color: #aaa;
        margin: 0 10px;
        text-decoration: none;
        transition: color 0.3s ease;
    }
    
    .footer-nav a:hover {
        color: #fff;
    }
    
    /* Link Styles */
    a {
        color: #5cb85c;
        text-decoration: none;
        font-weight: 500;
    }
    
    a:hover {
        text-decoration: underline;
        color: #4cae4c;
    }
    
    /* Code Tag Styles */
    code {
        font-family: 'Courier New', Courier, monospace;
        background-color: #f1f1f1;
        padding: 4px 6px;
        border-radius: 5px;
        color: #d9534f;
        font-size: 1rem;
    }
    
    /* Responsive Design */
    @media (max-width: 768px) {
        header h1 {
            font-size: 2.5rem;
        }
    
        main {
            padding: 20px;
            margin: 20px;
        }
    
        main p {
            font-size: 1rem;
        }
    
        .custom-button {
            width: 100%;
            padding: 15px;
        }
    }

Global Attributes

AttributesDescription
accesskeySpecifies a shortcut key to activate or focus an element.
autocapitalizeControls whether and how text input is automatically capitalized.
classSpecifies one or more class names for the element, allowing CSS styling and JavaScript manipulation.
contenteditableSpecifies whether the content of an element is editable or not.
contextmenuSpecifies a context menu for the element.
dirDefines the text direction. Possible values are "ltr" (left-to-right), "rtl" (right-to-left), and "auto".
draggableSpecifies whether an element is draggable. Possible values are "true" or "false".
enterkeyhintSpecifies the action label or icon to be shown for the enter key on virtual keyboards.
hiddenIndicates that the element is not yet, or is no longer, relevant. The browser does not display elements that have the `hidden` attribute set.
idSpecifies a unique identifier for the element.
inputmodeProvides a hint to browsers for which virtual keyboard configuration to use when editing this element or its descendants.
isAllows you to specify the type of custom element.
langSpecifies the language of the element's content.
nonceA cryptographic nonce ("number used once") that can be used by Content Security Policy (CSP) to determine whether or not a given fetch will be allowed to proceed.
partSpecifies the element’s part in the shadow DOM.
slotAssigns a slot in a shadow DOM shadow tree.
spellcheckIndicates whether the element is subject to spell checking.
styleProvides inline CSS styling for the element.
tabindexSpecifies the tab order of the element.
titleAdds extra information about the element, displayed as a tooltip when hovering over the element.
translateSpecifies whether the content of the element should be translated. Possible values are "yes" or "no".
HTML AttributesGlobal AttributesEvent Attributes
To view the full list
To view the full list
To view the full list
elementsChrome BrowsersMicrosoft Edge BrowserFirefox BrowsersSafari BrowserOpera Browser
<meta>YesYesYesYesYes