HomeHTMLHead Element in HTML

Head Element in HTML

Head Element in HTML

The HTML <head> element behaves like a container and it can contain following elements: <title>, <meta>, <script>, <base>, <link>, <style>.

<title> – Defines the title of the document. it will be displayed on the browser’s title bar or in the page’s tab.

Example:

<!DOCTYPE html>
<html>
<head>
  <title> PrepareExams.Com </title>
</head>
<body>
<p> The Text written in Title tag which will be displayed on the browser's title bar or in the page's tab.<p>
</body>
</html>

HTML <style> Element – This tag is used to define style information for a single HTML web page: for example, if you want to add some CSS for web page, we can define in the <style> tag.

Example:

<!DOCTYPE html>
<html>
<head>
  <title>PrepareExams.Com -  HTML Lessons </title>
  <style>
    h1 {
    color: red;
    }
  </style>
</head>  
<body>

<h1> Learn Style Tag - PrepareExams </h1>
<p> Set the Heading color to red </p>
  
</body>
</html>

<Link> Element:

We can add external style sheets using <link> element: for example

<!DOCTYPE html>
<html>
<head>
  <title> HTML - PrepareExams</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>

<h1> Welcome to PrepareExams </h1>
<p> Here, this is example of link element in HTML. </p>
  
</body>
</html>

<meta> element in HTML

It defines character set, page description, keywords, author of the document, and viewport settings.

Examples

ExampleDescription
<meta charset=”UTF-8″>Defines the character set
<meta name=”keywords” content=”PrepareExams,
Prepare Exams, Prepare for Exams”>
Defines the keywords
<meta name=”description” content=”Study with PrepareExams”>Defines the description of page
<meta name=”author” content=”Yashhuu”>Defines Author of web page
<meta name=”viewport”
content=”width=device-width, initial-scale=1.0″>
To make web pages good on all devices

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest News