[HTML5] head tag --HTML header

Write the HTML header inside the head tag . In the HTML header, describe auxiliary information that is not displayed on the screen.

<head>
  HTML header
</head>

Write the HTML header inside the HTML tag

Write the HTML header inside the html tag.

<html>
  <head>
    HTML header
  </head>
  <body>
    content
  </body>
</html>

What to specify in the HTML header

In the HTML header, you can specify:

  • CSS loading
  • JavaScript
  • Title
  • Character code
  • Site description
  • Keyword
  • Favicon
  • Viewport
<html>
  <head>
    <!-Meta->    <meta charset = "UTF-8">
    <meta name = "viewport" content = "width = device-width, initial-scale = 1">
    <link rel = "icon" type = "image / x-icon" href = "/ images / kimoto-system-favicon.png">
    <link rel = "stylesheet" type = "text / css" href = "/ css / common.css">

    <script type = "text / javascript" src = "/ js / jquery-1.9.0.min.js"> </script>
    <script type = "text / javascript" src = "/ js / google-code-prettify / prettify.js"> </script>
    <link type = "text / css" rel = "stylesheet" href = "/ js / google-code-prettify / prettify.css" />
    <script>
      $(function () {
        // Enable google code prettify
        $("pre"). addClass ("prettyprint");
        function init (event) {
          prettyPrint ();
        }
        if (window.addEventListener) window.addEventListener ("load", init, false);
        else if (window.attachEvent) window.attachEvent ("onload", init);
        
        $(". To-top"). click (function () {
          // Scroll to the top of the page.
          $('body, html'). animate ({scrollTop: 0}, 300,'linear') ;;
        });
      });
    </script>
  </head>
  <body>
    Content
  </body>
</html>

meta tag

The meta tag that specifies the character code and viewport is written in the HTML header.

<html>
  <head>
    <meta charset = "UTF-8">
    <meta name = "viewport" content = "width = device-width, initial-scale = 1">
  </head>
</html>

HTML template

DOCTYPE declaration and html tag, head tag , The body tag is the HTML template.

<! DOCTYPE html>
<html>
  <head>
    HTML header
  </head>
  <body>
    HTML content
  </body>
</html>

Associated Information