HTML Tutorial
HTML - Introduction HTML - Basic HTML - Structure HTML - Element HTML - Attributes HTML - Headings HTML - Paragraphs HTML - Styles HTML - Formatting HTML - Phrase Tags HTML - Quotations HTML - Comments HTML - Colors HTML - CSS HTML - Links HTML - Images HTML - Tables HTML - List HTML - Inline elements HTML - Block elements HTML - Classes HTML - Id HTML - Javascript HTML - File Path HTML - Iframe HTML - Responsive HTML - Computer Code HTML - Head tag HTML - Events HTML - Url Encoding HTML - Entities HTML - Validation
HTML Forms
HTML - Forms HTML - Form Elements HTML - Input types HTML - Input Attributes
HTML5 - Introduction HTML5 - New Elements HTML5 - Semantics HTML5 - Style Guide
HTML Media
HTML - Video HTML - Audio HTML - Embed Multimedia
HTML Graphics
HTML - Canvas HTML - SVG
HTML - Geolocation HTML - Drag & drop HTML - Web Storage HTML - Web Workers
HTML References
HTML - Tag Reference HTML - Tag by Category HTML - Attributes HTML - Global Attributes HTML - Events HTML - Language Codes HTML - Country Codes HTML - URL Encoding HTTP Methods HTTP Status Codes <input> types

HTML Head tag

The HTML head element provides general information (metadata) about the document.

The head of an HTML document is the part that is not displayed in the web browser when the page is loaded.

It contains information such as the page title, links to CSS (if you choose to style your HTML content with CSS), links to custom favicons, and other metadata (data about the HTML, such as the author, and important keywords that describe the document).

What is the HTML head?

The HTML <head> element is used for indicating the head section of the HTML document.

The head section's content is not displayed on the page.

Run code

A <head> element can have the following elements inside itself:

HTML <title> Element

When writing in HTML, the <title> element is required on every web page and is used to designate a title.

This element sets the default name for a bookmark, as well as what you see displayed on a browser tab or search engine results.

HTML Title element

It doesn't appear on the page itself but does show in the bar across the top of the browser and in the button in the taskbar.

Run code

You can't have more than one <title> element in an HTML document.

HTML <link> Element

The HTML <link> element is used to create a link between a web page and an external resource.

This element is most used to link to style sheets and Shortcut Icon.

This element is an empty element which means that it has no end tag.

Run code

HTML <style> Element

The HTML <style> element is used to define style information for a document, or part of a document.

It contains CSS, which is applied to the contents of the document containing the <style> element.

Run code

HTML <script> Element

The HTML <script> element is used for declaring a client-side script (such as JavaScript) within your HTML document.

This element either contains scripting statements, or it points to an external script file through the src attribute.

Run code

HTML <meta> Element

The HTML <meta> element contains information about the current document, such as its keywords, description, author etc.

This element is an empty element and so does not have a closing tag but it carries information within its attributes.

Run code

Meta Keywords

The keywords meta tag lists the search keywords for a site.

The keywords entered here should reflect any words or phrases Internet users might use to search for the site.

Although many search engines have ceased to incorporate this tag into their ranking procedures, it's still a good idea to add this tag before submitting a page.

Meta Description

The description meta tag defines site information a search engine displays when it lists the site.

The description meta tag should concisely explain the nature and contents of the page.

HTML meta description

Meta Robots

The Meta robots tag requests the robot (crawler) to not index the page.

Meta Charset

Meta charset declares the page's character encoding.

It specifies the character encoding used by the document. UTF-8 is one of the encoding methods.

Meta Viewport

A viewport controls how a webpage is displayed on a mobile device.

Without a viewport, mobile devices will render the page at a typical desktop screen width, scaled to fit the screen.

Setting a viewport gives control over the page's width and scaling on different devices.

HTML <base> Element

The HTML <base> element specifies the base URL to use for all relative URLs contained within a document.

There can be only one <base> element in a document.

Run code

HTML <noscript> Element

The HTML <noscript> element is used to handle the browsers which do recognize <script> tag and do not support scripting or if scripting is currently turned off in the browser. This tag is used to display alternate text message.

Run code

HTML head Elements

A <head> element can have the following elements inside itself:

Element Description
<title> This element describes the title of your page
<link> This element is used to create a link between a web page and an external resource
<meta> This element specifies metadata
<style> All internal stylesheet rules are written inside this element
<base> Defines a default address or a default target for all links on a page
<script> Defines a client-side script
<noscript> Specifies an alternate content for users that do not support client-side scripts