The <html> tag in HTML is used to define the root of HTML and XHTML documents. The <html> tag tells the browser that it is an HTML document. It is the second outer container for everything that appears in an HTML document followed by the <!DOCTYPE> tag. The <html> tag requires a starting and end tag.
Syntax:
<html> HTML Contents... </html>
Attribute Value: The <html> tag contains single attribute xmlns whose attribute value is http://www.w3.org/1999/xhtml. It is used to define the namespace attributes.
Below examples illustrate the <html> element in HTML:
Example 1:
<!DOCTYPE html> < html > < 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:
Example 2: Using the xmlns attribute inside the <html> tag.
<!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: The browser supported by <html> tag are listed below:
- Google Chrome
- Firefox
- Opera
- Internet Explorer
- Apple Safari
leave a comment
0 Comments