Welcome to the HTML Exercises lesson! This tutorial is designed to help you master HTML, the foundation of web development. Let's get started! 🚀
HTML (HyperText Markup Language) is the standard language for creating web pages. It defines the structure of a web page, allowing you to create text, links, images, and more.
Every HTML document starts with a <!DOCTYPE> declaration, followed by an <html> tag, which encloses the entire web page.
<!DOCTYPE html>
<html>
</html>The <head> section contains meta-information about the document, while the <body> section contains the visible content.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</body>
</html>HTML uses tags to define different parts of a web page. Each tag has an opening and closing tag. For example:
<h1>This is a heading</h1>Headings are used to organize content. There are six levels of headings, from <h1> (the largest) to <h6> (the smallest).
<h1>Heading Level 1</h1>
<h2>Heading Level 2</h2>
...
<h6>Heading Level 6</h6>Use the <p> tag to create paragraphs.
<p>This is a paragraph.</p>Create links using the <a> tag.
<a href="https://www.example.com">Link Text</a>Use the <img> tag to embed images in your web page.
<img src="image.jpg" alt="Image Description">Use the <ol> tag for ordered lists. Each item in the list is a <li>.
<ol>
<li>First item</li>
<li>Second item</li>
</ol>Use the <ul> tag for unordered lists. Each item in the list is a <li>.
<ul>
<li>First item</li>
<li>Second item</li>
</ul>HTML forms allow users to interact with your web page. Use the <form> tag to create a form.
<form>
<!-- Form elements go here -->
</form>What is the purpose of the <!DOCTYPE> declaration in HTML?
Correct: B
Explanation: The <!DOCTYPE> declaration specifies the Document Type Definition (DTD) for the HTML document, which helps to ensure that the document conforms to the HTML standard.
What is the purpose of the <head> section in HTML?
Correct: B
Explanation: The <head> section contains meta-information about the HTML document, such as the title, style sheets, scripts, and more.
What is the purpose of the <body> section in HTML?
Correct: A
Explanation: The <body> section contains the visible content of the web page, such as text, images, links, and more.
What is the purpose of the <a> tag in HTML?
Correct: A
Explanation: The <a> tag defines a hyperlink, which allows users to navigate to other web pages or resources.
What is the purpose of the <img> tag in HTML?
Correct: D
Explanation: The <img> tag defines an image in an HTML document.
What is the purpose of the <ol> tag in HTML?
Correct: A
Explanation: The <ol> tag defines an ordered list, which displays items in a numerical order.
What is the purpose of the <ul> tag in HTML?
Correct: B
Explanation: The <ul> tag defines an unordered list, which displays items in a bullet-point format.
What is the purpose of the <form> tag in HTML?
Correct: D
Explanation: The <form> tag defines a form for user input, allowing users to interact with your web page.
What is the purpose of the <h1> tag in HTML?
Correct: A
Explanation: The <h1> tag defines a heading of level 1, which is the largest heading level in HTML.
What is the purpose of the <p> tag in HTML?
Correct: A
Explanation: The <p> tag defines a paragraph in an HTML document.