Easy Tutorial
❮ Tag Iframe Av Prop Mediagroup ❯

HTML <head>


View Online Examples

<title> - Defines the title of the HTML document

<base> - Defines the base URL for all links in the document

<meta> - Provides meta tags for the HTML document


HTML <head> Element

The <head> element contains all the head elements. Within the <head> element, you can insert scripts, style sheets, and various meta information.

Elements that can be added in the head section include: <title>, <style>, <meta>, <link>, <script>, <noscript>, and <base>.


HTML <title> Element

The <title> tag defines the title of the document.

The <title> is required in HTML/XHTML documents.

The <title> element:

A simple HTML document:

Example

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>Document Title</title>
</head>

<body>
Document content...
</body>

</html>

HTML <base> Element

The <base> tag specifies the base URL/target for all relative URLs in a document.

Example

<head>
<base href="http://www.tutorialpro.org/images/" target="_blank">
</head>

HTML <link> Element

The <link> tag defines the relationship between the document and an external resource.

The <link> tag is often used to link to style sheets:

Example

<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>

HTML <style> Element

The <style> tag specifies the style sheet for the HTML document.

Within the <style> element, you can also add styles directly to render the HTML document:

Example

<head>
<style type="text/css">
body {
    background-color:yellow;
}
p {
    color:blue
}
</style>
</head>

HTML <meta> Element

The meta tag describes basic metadata.

The <meta> tag provides metadata. Metadata is not displayed on the page but is parsed by the browser.

The META element is typically used to specify the description, keywords, file last modification time, author, and other metadata.

Metadata can be used by browsers (how to display content or reload the page), search engines (keywords), or other web services.

The <meta> is usually placed in the <head> section.

<meta> Tag - Usage Example

Define keywords for search engines:

<meta name="keywords" content="HTML, CSS, XML, XHTML, JavaScript">

Define the description of the web page:

<meta name="description" content="Free Web & Programming Tutorials">

Define the author of the web page:

<meta name="author" content="tutorialpro">

Refresh the page every 30 seconds:

<meta http-equiv="refresh" content="30">

HTML <script> Element

The <script> tag is used to load script files, such as JavaScript.

The <script> element will be described in detail in later chapters.


HTML Head Elements

Tag Description
<head> Defines the document's information
<title> Defines the document's title
<base> Defines the default link address for link tags
<link> Defines the relationship between a document and an external resource
<meta> Defines metadata in an HTML document
<script> Defines a client-side script file
<style> Defines the style sheet for the HTML document
❮ Tag Iframe Av Prop Mediagroup ❯