1. What is HTML?
- Answer: HTML (HyperText Markup Language) is
the standard language for creating web pages. It
describes the structure of a webpage using
markup.
2. What are HTML tags?
- Answer: HTML tags are the basic building blocks
of HTML. They are used to define and structure
content on a webpage.
3. What is the purpose of the <!DOCTYPE html>
declaration?
- Answer: The <!DOCTYPE html> declaration
defines the document type and version of HTML
being used, ensuring the browser renders the page
correctly.
4. What is the difference between HTML elements
and tags?
, - Answer: Tags are the building blocks that define
HTML elements. An HTML element consists of a
start tag, content, and an end tag.
5. How do you create a hyperlink in HTML?
- Answer: Use the <a> tag with the href attribute.
For example: `<a
href="https://www.example.com">Link</a>`.
6. What is the purpose of the <head> element?
- Answer: The <head> element contains meta-
information about the document, such as the title,
character set, and links to stylesheets.
7. How do you create a list in HTML?
- Answer: Use <ul> for unordered lists and <ol>
for ordered lists. List items are defined with the
<li> tag.
8. What are HTML attributes?
- Answer: Attributes provide additional
information about HTML elements and are always
included in the opening tag.
,9. What is the difference between block-level and
inline elements?
- Answer: Block-level elements start on a new line
and take up the full width, while inline elements do
not start on a new line and only take up as much
width as necessary.
10. How do you add an image to a webpage?
- Answer: Use the <img> tag with the src
attribute. For example: `<img src="image.jpg"
alt="Description">`.
Intermediate HTML Questions
11. What is the <meta> tag used for?
- Answer: The <meta> tag provides metadata
about the HTML document, such as character set,
author, and viewport settings.
12. How do you create a table in HTML?
- Answer: Use the <table> tag, with <tr> for
table rows, <th> for table headers, and <td> for
table data cells.
, 13. What is the purpose of the <form> element?
- Answer: The <form> element is used to create
a form for user input, with attributes like action and
method.
14. What are semantic HTML elements?
- Answer: Semantic HTML elements clearly
describe their meaning in a human- and machine-
readable way, such as <article>, <section>,
<header>, and <footer>.
15. How do you create a checkbox in HTML?
- Answer: Use the <input> tag with the type
attribute set to "checkbox". For example: `<input
type="checkbox">`.
16. What is the difference between <div> and
<span>?
- Answer: <div> is a block-level element used for
grouping content, while <span> is an inline
element used for styling small pieces of content.
17. How do you create a dropdown list in HTML?