HTML Head

HTML Head

HTML <head> element is used as a container for metadata (data about data).

It defines the document title, styles, links, script and other meta information.

Below the following tags are used in metadata.

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

  • <title> - It is used to define the title of the document.
  • <style> - It is used to style the HTML page..
  • <meta> - It is used to specify the page description, keywords and other metadata on your webpage.
  • <link> - It is used to link an style sheet to your webpage.
  • <script> - It is used to link an javascript to your webpage.
  • <base> - It is used to specify the base URL and base target for all relative URLs in a page.

HTML <title> Element

Below an example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Title</title>
</head>
<body>
   <p>The title is displayed in the browser tab</p>   
 </body>
</html>

HTML <style> Element

Below an example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Title</title>
<style>
h1 {  
    color:#505763;  
    font-size:26px;  
}
p {  
    color:#333;  
    font-size:14px;  
}
</style>  
</head>
<body>
   <h1>This is a heading</h1>   
   <p>This is a paragraph</p>   
 </body>
</html>

HTML <base> Element

Below an example:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Page Title</title>  
<base href="https://nexladder.com/" />  
</head>
<body>
   <img src="images/nexlogo.png" />   
 </body>
</html>