HTML ASSIGNMENT – DAY 1
[Link] are HTML heading tags?
How many levels of headings are available? Give examples of each.
ANS:- HTML heading tags are used to define headings on a web page. They help structure
the content and indicate the importance of each section. Headings range from the most
important (<h1>) to the least important (<h6>).
EXAMPLES:
<h1>This is a Heading 1</h1>
<h2>This is a Heading 2</h2>
[Link] any five HTML formatting tags with syntax and usage.
ANS:- <b> – Makes the text bold.
Example: <b>Hello</b> → Hello
<i> – Makes the text italic.
Example: <i>World</i> → World
<u> – Underlines the text.
Example: <u>Important</u> → <u>Important</u>
<mark> – Highlights the text with a yellow background.
Example: <mark>Note this</mark> → <mark>Note this</mark>
<small> – Displays the text in a smaller font size.
Example: <small>Footnote</small> → <small>Footnote</small>
[Link] a simple HTML page using heading tags from <h1> to <h6> and
show how each one appears differently.
ANS:-
<!DOCTYPE html>
<html>
<head>
<title>Assignment 1</title>
</head>
<body>
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
</body>
</html>
[Link] is the difference between an ordered list and an unordered list in
HTML?
ANS:- In HTML, an ordered list (<ol>) is used when the order of items matters, such as in
instructions, steps, or rankings. It displays items in a numbered format (e.g., 1, 2, 3). On the
other hand, an unordered list (<ul>) is used when the order is not important, such as listing
groceries or names. It displays items with bullet points.
<!DOCTYPE html>
<html>
<head>
<title>HTML Lists Example</title>
</head>
<body>
<h2>Ordered List (Steps to Make Tea)</h2>
<ol>
<li>Boil water</li>
<li>Add tea leaves</li>
<li>Pour in a cup</li>
<li>Add sugar and milk</li>
<li>Stir and serve</li>
</ol>
<h2>Unordered List (Grocery Items)</h2>
<ul>
<li>Milk</li>
<li>Bread</li>
<li>Eggs</li>
<li>Butter</li>
<li>Fruits</li>
</ul>
</body>
</html>
5. Write the HTML code to create the following:
A heading: "My Favorite Fruits"
- An ordered list of 3 fruits
- An unordered list of 3 vegetables
ANS:- <!DOCTYPE html>
<html>
<head>
<title>My Favorite Fruits and Vegetables</title>
</head>
<body>
<h1>My Favorite Fruits</h1>
<ol>
<li>Apple</li>
<li>Banana</li>
<li>Mango</li>
</ol>
<ul>
<li>Carrot</li>
<li>Spinach</li>
<li>Broccoli</li>
</ul>
</body>
</html>