1. What is HTML?
HTML stands for HyperText Markup Language. It is a standard text formatting language used for developing web pages released in 1993.
<!DOCTYPE html>
<html>
<head>
<title>My First Page</title>
</head>
<body>
<h1>Hello, World!</h1>
</body>
</html>2. What is the purpose of the <!DOCTYPE html> declaration?
The <!DOCTYPE html> tells the browser to use HTML5 standard. It must be the very first line in an HTML document.
<!DOCTYPE html>3. What are semantic elements in HTML?
Semantic elements clearly describe their meaning. Examples include: <article>, <section>, <header>, <footer>, <nav>.
<article>
<h2>Blog Title</h2>
<p>This is a blog post.</p>
</article>4. What is the difference between <div> and <span>?
<div>is a block-level container.<span>is an inline-level container.
<div>This is a block</div>
<span>This is inline</span>5. How do you create a link in HTML?
Use the <a> tag and the href attribute.
<a href="https://example.com" target="_blank">Visit Example</a>target="_blank"opens the link in a new tab.
6. How do you insert an image in HTML?
Use the <img> tag with src and alt attributes.
<img src="logo.png" alt="Website Logo" width="200" />altis for screen readers and when the image fails to load.
7. How can you create a list in HTML?
- Unordered list uses
<ul>. - Ordered list uses
<ol>.
<ul>
<li>HTML</li>
<li>CSS</li>
</ul>
<ol>
<li>Step 1</li>
<li>Step 2</li>
</ol>8. What are form elements in HTML?
Forms are created using the <form> tag and may include:
<input>,<textarea>,<button>,<select>,<label>, etc.
<form>
<label for="name">Name:</label>
<input id="name" type="text" name="name" />
<button type="submit">Submit</button>
</form>9. What is the use of the alt attribute in an image tag?
The alt attribute provides alternative text for screen readers and displays when the image can’t load.
<img src="photo.jpg" alt="My Profile Photo" />10. How do you create a table in HTML?
Use the <table>, <tr>, <th>, and <td> tags.
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>Kawsar</td>
<td>28</td>
</tr>
</table>11. What are void elements in HTML?
HTML elements which do not have closing tags or do not need to be closed are Void elements.
<br />
<img />
<hr />12. What are HTML Entities?
In HTML, some characters are reserved (like <, >, /, &) and cannot be used directly because they conflict with the syntax of the language.
To display these characters on a webpage, we use HTML Entities.
Common Examples:
| Character | Entity Name | Entity Number |
|---|---|---|
< (less than) | < | < |
> (greater than) | > | > |
& (ampersand) | & | & |
| (non-breaking space) | |   |
Example:
<p>10 PM</p>13. What are HTML Tags?
HTML tags are the building blocks of an HTML document. They define the structure and content of web pages.
Each HTML tag usually comes in a pair:
- Opening tag:
<tagname> - Closing tag:
</tagname>
Example:
<p>Hello, world!</p>14. What is a <marquee> in HTML?
The <marquee> tag in HTML is used to create scrolling text or images on a webpage — either horizontally or vertically.
Key Features:
- Scrolls content automatically.
- Can control speed, direction, and behavior.
- Not part of modern HTML standards and is deprecated in HTML5.
Example:
<marquee behavior="scroll" direction="left">This is a scrolling message</marquee>15. What is the advantage of collapsing white space?
Collapsing white space means that the browser treats multiple spaces, tabs, and newlines as a single space when rendering HTML content.
Advantages:
- Cleaner output: Prevents extra spacing from affecting layout unintentionally.
- Improved readability: Developers can format HTML code with proper indentation without impacting display.
- Smaller file size: Extra spaces and line breaks aren’t rendered, which helps optimize performance.
- Consistency: Ensures uniform text display across different browsers and screen sizes.
Example:
<p>This is text.</p>16. How do you insert a copyright symbol in HTML?
In HTML, you can insert a copyright symbol using an HTML entity.
Methods:
- Entity name:
© - Entity number:
©
Example:
<p>© 2025 Your Company</p>