HTML Important Questions & Answers
1. What is HTML? Describe a structure of an HTML document as well as text formatting tags.
HTML (HyperText Markup Language) is the standard language for creating web pages. It provides
the structure of web pages using elements and tags.
Basic Structure of an HTML Document:
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
</head>
<body>
<h1>Welcome</h1>
</body>
</html>
Text Formatting Tags: <b>, <i>, <u>, <sup>, <sub>, <mark>
2. Explain in detail HTML list element.
HTML provides three types of lists:
1. Ordered List (<ol>)
2. Unordered List (<ul>)
3. Definition List (<dl>).
3. How to create a CSS file & elaborate on constructing style?
A CSS file (.css) defines styles for an HTML page.
Example:
body { background-color: lightgray; }
4. Explain various attributes to create a table along with examples & output.
The <table> tag is used to create tables. Key attributes: border, cellpadding, cellspacing, rowspan,
colspan.
Example:
<table border='1'><tr><th>Name</th><th>Age</th></tr><tr><td>John</td><td>25</td></tr></table>
5. How are multimedia objects incorporated in HTML?
Use <audio> and <video> tags.
Example:
<audio controls><source src='audio.mp3'></audio>
<video controls><source src='video.mp4'></video>
6. Write a program to format different text using a style sheet.
Create styles.css and link it in HTML.
Example:
.heading { color: blue; }
<p class='heading'>Styled Text</p>
7. Elaborate on the link tag with an example.
The <a> tag is used to create hyperlinks.
Example:
<a href='https://google.com' target='_blank'>Google</a>
8. Explain CSS selectors in detail.
CSS selectors:
1. Element: p {color: red;}
2. Class: .myClass {font-size: 20px;}
3. ID: #myID {background-color: yellow;}
9. Elaborate on preparing graphics for web use.
Use optimized formats (PNG, JPEG, SVG). Use CSS for simple graphics.
Example:
.box { width: 100px; height: 100px; background: red; }
10. Outline to create a text-based & graphical navigation bar.
Use <nav> for text-based navigation.
Example:
<nav><a href='home.html'>Home</a></nav>
For graphical, use CSS styles and hover effects.