THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML Head


The HTML <head> Element

HTML metadata is data about the HTML document. Metadata is not displayed in web page.

Metadata typically define document title, styles, links, scripts, and other meta information.


Omitting <html> and <body>

HTML5, the <html> tag, the <head> tag , and the <body> tag can be omitted.

The following example:

Example

<!DOCTYPE html>
<title>Page Title</title>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>
Try it Yourself »

The <html> element is the document root

<!DOCTYPE html>
<html lang="en-UK">

it is a language is important for accessibility applications and search engines.

Omitting <html> and <body> can crash badly-written DOM/XML software.

Finally, omitting <body> can produce errors in older browsers (IE9).


Omitting <head>

In the HTML5 standard, the <head> tag can also be omitted.

&It;head&It; element can be place all element before body elements

example of omitting the &It;head&It;

Example

<!DOCTYPE html>
<html>
<title>Page Title</title>
<body>

<h1>This is a heading</h1>
<p>This is a paragraph.</p>

</body>
</html>
Try it Yourself »
.

The HTML <title> Element

The <title> element are very important for seo.

The <title> element indicate title of the document.

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

The <title> element:

  • indecate a title in the browser tab
  • Google and yahoo work on displays a title for the page in search engine results

A simplified HTML document:

Example

<!DOCTYPE html>
<html>
<title>Page Title</title>

<body>
This is my web page
</body>

</html>
Try it Yourself »

The HTML <style> Element

The <style> element is used to define style information for an HTML document.

Inside the <style> element you specify how HTML elements should render in a browser:

Example

<style>
body {background-color:#CC927D;}
h1{color:#CC515A}
p {color:#424ECC;}
</style>
Try it Yourself »

The HTML <link> Element

The <link> element is use to link to style sheets:

The <link> element is the page relationship to an external resource.

Example

<link rel="stylesheet" href="mystyle.css">
Try it Yourself »

The HTML <meta> Element

The <meta> element is used to specify page description, keywords, author, and other metadata.

Metadata is very important for webpage it helps us to browser by SEARCH ENGINE(GOOGLE,YAHOO,BING) keyword .

Understand keywords for search engines:

<meta name="keywords" content="Android,c++,HTML, JavaScript">

Understand a description of your web page:

<meta name="description" content="Free tutorials PROGAMMING">

Understand the character set used:

<meta charset="UTF-8">

Understand the author of a page:

<meta name="author" content="Hege Refsnes">

Example of <meta> tags:

Example

<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML,CSS,XML,JavaScript">
<meta name="author" content="Hege Refsnes">
<meta charset="UTF-8">

The HTML <script> Element

The <script> element is used to define client-side JavaScripts.

The script below writes Hello JavaScript! into an HTML element with id="demo":

Example

<script>
function myFunction {
    document.getElementById("demo").innerHTML = "Hello JavaScript!";
}
</script>
Try it Yourself »
!

The HTML <base> Element

The <base> element specifies the base URL and base target for all relative URLs in a page:

Example

<base href="http://www.welookups.com/images/" target="_blank">
Try it Yourself »