The <html>
tag defines the root of HTML/XHTML docs, indicating it’s an HTML doc, serving as the main container, following the <!DOCTYPE>
. Requires both opening and closing tags.
The <html>
tag acts as the main container for all HTML elements (excluding <!DOCTYPE>
), framing the entire web content structure.
Syntax
<html> HTML Contents... </html>
Default CSS
The following default values are mostly displayed by the current browsers:
html {
 display: block;
visibility: visible
}
Attribute Value
The <html>
tag includes the xmlns
attribute. This attribute defines the namespace for attributes, ensuring proper interpretation and compatibility of XHTML elements.
Note: The <html> tag supports the Global Attributes in HTML.
Example 1:Â This example illustrates the <html> element in HTML.
HTML
<!DOCTYPE html>
< html >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >
< html > Tag
</ h2 >
</ body >
</ html >
|
Output:
Example 2: In this example, we will be using the xmlns attribute inside the <html> tag.Â
HTML
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
< head >
< title >html Tag</ title >
< style >
h1 {
color: green;
}
body {
text-align: center;
}
</ style >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >
< html > Tag
</ h2 >
</ body >
</ html >
|
Output:
Supported Browsers
- Google Chrome 1 and above
- Edge 12 and above
- Firefox 1 and above
- Safari
- Opera
Last Updated :
20 Dec, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...