HTML Element: html

The html element is the root of an HTML document. This element is required to create a valid page.

Example

Syntax

1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
  <title>My Favorite Foods</title>
5
</head>
6
<body>
7
  <h1>My Favorite Foods</h1>
8
  <p>Eu non fugiat sunt cupidatat consequat. Dolore nostrud id tempor aute pariatur sit veniam pariatur velit voluptate voluptate excepteur reprehenderit.</p>
9
</body>
10
</html>

Browser Support

The html element is supported in all modern browsers. Read more on caniuse.com.

Attributes

An html element supports Global Attributes in HTML. Global Attributes are common to all HTML elements and can be used on all of them (though they may not have much of an effect on some of them).

Additional attributes:
  • manifest: Specifies the URI of a resource manifest indicating resources that should be cached locally.
  • version: Specifies the version of the HTML Document Type Definition that governs the current document. This attribute is not necessary.
  • xmlns: Specifies the XML Namespace of the document. The default value is "https://www.w3.org/1999/xhtml"

Don’t Forget the lang Attribute

The HTML lang attribute should always be included on a web page’s <html> element. It’s used to specify the language of text content within the document. This helps search engines deliver search results in the correct language, and helps screen readers switch language profiles for correct accents and pronunciation.

In the syntax example above you’ll see <html lang="en"> which uses the two-letter ISO code for English as the language.

Failing to include the lang attribute on the opening html tag will trigger a warning when validating the document.

screenshot of validation warning when omitting the lang attribute on html elementscreenshot of validation warning when omitting the lang attribute on html elementscreenshot of validation warning when omitting the lang attribute on html element

Content

The html content model is limited and only contains support for the head and body elements.

Did you know? The first version of HTML was written by Tim Berners-Lee in 1993. The widest adoption of the language occurred when HTML was updated to version 4.0.1. Today most modern browsers and websites run the HTML5 specification.

Learn More


This content originally appeared on Envato Tuts+ Tutorials and was authored by Andy Leverenz

The html element is the root of an HTML document. This element is required to create a valid page.

Example

Syntax

1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
  <title>My Favorite Foods</title>
5
</head>
6
<body>
7
  <h1>My Favorite Foods</h1>
8
  <p>Eu non fugiat sunt cupidatat consequat. Dolore nostrud id tempor aute pariatur sit veniam pariatur velit voluptate voluptate excepteur reprehenderit.</p>
9
</body>
10
</html>

Browser Support

The html element is supported in all modern browsers. Read more on caniuse.com.

Attributes

An html element supports Global Attributes in HTML. Global Attributes are common to all HTML elements and can be used on all of them (though they may not have much of an effect on some of them).

Additional attributes:
  • manifest: Specifies the URI of a resource manifest indicating resources that should be cached locally.
  • version: Specifies the version of the HTML Document Type Definition that governs the current document. This attribute is not necessary.
  • xmlns: Specifies the XML Namespace of the document. The default value is "https://www.w3.org/1999/xhtml"

Don’t Forget the lang Attribute

The HTML lang attribute should always be included on a web page’s <html> element. It’s used to specify the language of text content within the document. This helps search engines deliver search results in the correct language, and helps screen readers switch language profiles for correct accents and pronunciation.

In the syntax example above you’ll see <html lang="en"> which uses the two-letter ISO code for English as the language.

Failing to include the lang attribute on the opening html tag will trigger a warning when validating the document.

screenshot of validation warning when omitting the lang attribute on html elementscreenshot of validation warning when omitting the lang attribute on html elementscreenshot of validation warning when omitting the lang attribute on html element

Content

The html content model is limited and only contains support for the head and body elements.

Did you know? The first version of HTML was written by Tim Berners-Lee in 1993. The widest adoption of the language occurred when HTML was updated to version 4.0.1. Today most modern browsers and websites run the HTML5 specification.

Learn More


This content originally appeared on Envato Tuts+ Tutorials and was authored by Andy Leverenz


Print Share Comment Cite Upload Translate Updates
APA

Andy Leverenz | Sciencx (2023-03-20T19:53:58+00:00) HTML Element: html. Retrieved from https://www.scien.cx/2023/03/20/html-element-html/

MLA
" » HTML Element: html." Andy Leverenz | Sciencx - Monday March 20, 2023, https://www.scien.cx/2023/03/20/html-element-html/
HARVARD
Andy Leverenz | Sciencx Monday March 20, 2023 » HTML Element: html., viewed ,<https://www.scien.cx/2023/03/20/html-element-html/>
VANCOUVER
Andy Leverenz | Sciencx - » HTML Element: html. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2023/03/20/html-element-html/
CHICAGO
" » HTML Element: html." Andy Leverenz | Sciencx - Accessed . https://www.scien.cx/2023/03/20/html-element-html/
IEEE
" » HTML Element: html." Andy Leverenz | Sciencx [Online]. Available: https://www.scien.cx/2023/03/20/html-element-html/. [Accessed: ]
rf:citation
» HTML Element: html | Andy Leverenz | Sciencx | https://www.scien.cx/2023/03/20/html-element-html/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.