Tag: <html> MCQs Quiz | Class 10
This quiz for Class X, Subject Computer Applications (Code 165), covers Unit 2: HTML, focusing on the <html> tag, its role as the document root, and the overall structure of an HTML document. Test your knowledge, then submit your answers to see your score and download a detailed PDF of your responses.
Understanding the `<html>` Tag: The Document Root
The <html> tag is the fundamental building block of every HTML document. It serves as the root element, encapsulating all other elements within an HTML page. This section will delve into its significance, structure, and essential aspects.
What is the `<html>` Tag?
The <html> tag, often referred to as the root element, defines the entire HTML document. It tells the browser that everything contained within its opening (<html>) and closing (</html>) tags is part of the HTML document. While modern browsers are quite forgiving and can often render pages even if this tag is omitted, it is crucial for proper document structure, accessibility, and validation.
Overall Structure of an HTML Document
A typical HTML document follows a clear, hierarchical structure, with the <html> tag at its apex. Inside the <html> tag, there are primarily two direct child elements:
<head>: This section contains metadata about the HTML document. This metadata is not displayed on the web page itself but provides important information to browsers, search engines, and other web services. Examples include the page title (<title>), links to external stylesheets (<link>), script files (<script>), meta descriptions (<meta>), and character set declarations (<meta charset="UTF-8">).<body>: This section contains all the visible content of the web page. Everything you see in your browser window – text, images, videos, tables, forms, etc. – is defined within the<body>tags.
The basic structure looks like this:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Web Page</title>
</head>
<body>
<h1>Welcome!</h1>
<p>This is the content.</p>
</body>
</html>
Key Attributes of the `<html>` Tag
The <html> tag can have attributes that provide additional information about the document. The most commonly used attribute is lang.
| Attribute | Description | Example |
|---|---|---|
lang |
Specifies the primary language of the document content. This is important for accessibility tools (screen readers), search engines, and browser rendering. | <html lang="en"> (English)<html lang="hi"> (Hindi) |
manifest |
(Deprecated in HTML5.1) Specifies the path to an application cache manifest file, used for offline web applications. | <html manifest="example.appcache"> |
Quick Revision List
- The
<html>tag is the root element of an HTML document. - It encloses all other HTML elements.
- Its two direct children are
<head>(metadata) and<body>(visible content). - The
langattribute is crucial for accessibility and language declaration. - Always start an HTML document with
<!DOCTYPE html>followed by<html>.
Practice Questions
- Which declaration must come before the
<html>tag in an HTML5 document? - Can an HTML document exist without a
<body>tag? What would be the consequence? - Explain the difference in purpose between the
<head>and<body>tags. - What is the benefit of declaring the language using the
langattribute on the<html>tag? - If you wanted to link an external CSS file, within which direct child of the
<html>tag would you place the<link>tag?