Code has been added to clipboard!

html Tag

Reading time 2 min
Published Jun 29, 2017
Updated Jan 20, 2020

html Tag: Main Tips

  • The <html> tags are used to define the root element of an HTML file.
  • The opening tag for the element is placed right after the <!DOCTYPE> declaration in the beginning of the HTML document.
  • You don't need to define the XML namespace in HTML5.

What Is an <html> Tag?

You should notice the <html> tag in the beginning of every HTML document, and the closing </html> tag at its very end:

Example
<!DOCTYPE html>
<html>
<head>

<title>Your document title should be here</title>

<p>Links and scripts go here.</p>

</head>
<body>

<p>This is where you write the main content and other HTML elements.</p>

</body>
</html>

Every HTML document is made up of nested elements. The first and foremost element that you need to nest all other elements to is called the root element. It is the parent or ancestor to every element, but cannot have any parent elements itself. In an HTML document, the root element has to be <html>.

The xmlns Attribute

You can include an xmlns attribute to set an XML namespace for HTML documents parsed with an XML parser:

Example
<html xmlns="http://www.w3.org/1999/xhtml">

However, it is not necessary, as all HTML5 elements are automatically in in the namespace you can see in the example. This attribute is a remnant from XHTML, where it was actually required to include.

In HTML5, you can add it or skip it – the page will be displayed in the same manner, no matter which browser the website visitor is using.

Browser support

Chrome
All
Edge
All
Firefox
All
IE
All
Opera
All
Safari
All

Mobile browser support

Chrome
All
Firefox
All
Opera
All
Safari
All
Basics
Introduction
Syntax
Editors
Basic Examples
Head Section
<!DOCTYPE>
Tags and Elements
Semantic Elements
Tags Reference
Attributes
Comments
Block and Inline Elements
Forms
Form Elements
Input
Responsive Web Design
Inline Scripts
Uniform Resource Locator
Redirect
XHTML
Geolocation
Drag and Drop
Local Storage
Web Workers
Server-Sent Events
Character Encoding
Text Formatting
Quotation and Citation Elements
Headings
Paragraphs
Links
Tables
Lists
Symbols
Space
Tab
Styles
Computer Code
Layout
Classes
Colors
Images
iframes
Audio Player
Video Player
YouTube Videos
Multimedia
Canvas
SVG
<!-- -->
<a>
<abbr>
<acronym> DEPRECATED
<address>
<applet> DEPRECATED
<article>
<aside>
<audio>
<b>
<base>
<basefont> DEPRECATED
<bdi>
<bdo>
<big> DEPRECATED
<blink> DEPRECATED
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center> DEPRECATED
<cite>
<code>
<col>
<colgroup>
<datalist>
<dd>
<del>
<details>
<dfn>
<dialog>
<dir> DEPRECATED
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font> DEPRECATED
<footer>
<form>
<frame> DEPRECATED
<frameset> DEPRECATED
<h1> – <h6>
<head>
<header>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<keygen> DEPRECATED
<label>
<legend>
<li>
<link>
<main>
<map>
<mark>
<menu>
<menuitem> DEPRECATED
<meta>
<meter>
<nav>
<noframes> DEPRECATED
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike> DEPRECATED
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt> DEPRECATED
<u>
<ul>
<var>
<video>
<wbr>