• Core Java
  • PHP
  • SQL Tutorial
  • RubyonRails
  • Struts
  • JSP
  • Spring
  • JavaScript
  • Java IO

  • <

    HTML Head

    The HTML <head> element is used as a container for metadata (data about data). It is used between <html> tag and <body> tag.

    HTML metadata is not displayed. It only specifies data about the HTML document.

    Metadata defines the document title, character set, styles, links, scripts, and other meta information.

    Tags used in metadata:

    <title>, <style>, <meta>, <link>, <script>, and <base>.

    HTML <title> Element

    The <title> element defines the title of the document, and is required in all HTML/XHTML documents.

    <title> Example



    
    <!DOCTYPE html>
    <html>
    <head>
      <title>Title</title>
    </head>
    <body>
    
    <p>The content of the body element.</p>
    
    
    </body>
    </html>
    


    HTML <style> Example

    The <style> element is used to define style information for a single HTML page.

    Example



    <!DOCTYPE html>
    <html>
    <head>
      <title>Page Title</title>
      <style>
        body {background-color: powderblue;}
        h1 {color: green;}    
        
      </style>
    </head>  
    <body>
    
    <h1>Welcome to JAVAMEANT</h1>
    
    </body>
    </html>
    


    HTML <link>

    The <link> element is used to link to external style sheets:

    Example



    <!DOCTYPE html>
    <html>
    <head>
      <title>Page Title</title>
      <link rel="stylesheet" href="mystyle.css">
    </head>
    <body>
    
    <h1>link tutorial</h1>
     
    </body>
    </html>
    


    HTML <meta>

    The <meta> element is used to specify which character set is used, page description, keywords, author, and other metadata.

    Metadata is used by browsers (how to display content), by search engines (keywords), and other web services.

    Example



    //Define a description of your web page:
    
    <meta name="description" content="Free Web tutorials">
    
    //Define keywords for search engines:
    
    <meta name="keywords" content="HTML, CSS, XML, JavaScript">
    
    //Define the author of a page:
    
    <meta name="author" content="John Doe">
    


    Setting The Viewport

    HTML5 introduced a method to let web designers take control over the viewport, through the <meta> tag.

    The viewport is the user's visible area of a web page. It varies with the device, and will be smaller on a mobile phone than on a computer screen.

    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    


    HTML <script>

    The <script> element is used to define client-side JavaScripts.

    Example



    
    
    <!DOCTYPE html>
    <html>
    <head>
      <title>Page Title</title>
      <script>
      function myFunction() {
        document.getElementById("test").innerHTML = "Hello javameant";
      }
      </script>
    </head>
    <body>
    
    <h1>My Web Page</h1>
    <p id="test"></p>
    <button type="button" onclick="myFunction()">Try it</button>
    
    </body>
    </html>
    
    
    


    HTML <base>

    The element specifies the base URL and base target for all relative URLs in a page:

    Example



    
    
    <!DOCTYPE html>
    <html>
    <head>
      <title>Page Title</title>
      <base href="https://www.google.com/" target="_blank">
    </head>
    <body>
    
    <p>HTML base tutorial</p>
    
    </body>
    </html>
    
    
    
















    © copyright 2017-2021 Completedone pvt ltd.