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).
-
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.
Content
The html
content model is limited and only contains support for the head
and body
elements.
Learn More
This content originally appeared on Envato Tuts+ Tutorials and was authored by Andy Leverenz
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/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.