HTML_Interview_Questions
HTML_Interview_Questions
# HTML Interview Questions with Answers for Beginners and Intermediate Levels
HTML (HyperText Markup Language) is the standard language used to create web pages. It
HTML tags are used to define elements in an HTML document. They are enclosed in angle
brackets, e.g., <p> for paragraphs. Tags often come in pairs: an opening tag <p> and a closing tag
</p>.
- XHTML is a stricter version of HTML, requiring proper nesting, case sensitivity, and closing of tags.
The <!DOCTYPE> declaration specifies the version of HTML used in the document. It helps the
Void elements are HTML elements that do not require a closing tag. Examples include <img>, <br>,
and <input>.
HTML Interview Questions with Answers
- id: Used to uniquely identify a single element. It must be unique within the document.
The <meta> tag provides metadata about the HTML document, such as character encoding,
### 9. What is the difference between inline, block, and inline-block elements?
- Inline: Does not start on a new line and takes up only as much width as necessary (e.g., <span>).
- Block: Starts on a new line and takes up the full width (e.g., <div>).
### 11. What is the difference between <section>, <div>, and <article>?
The <canvas> element is used to draw graphics on a web page using JavaScript. Example usage
Semantic HTML elements have meaningful names that indicate their purpose. Examples include
Use the <table> tag along with <tr> (table row), <th> (table header), and <td> (table data) tags.
Example:
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>John</td>
<td>25</td>
</tr>
</table>
Use the <meta> tag for viewport settings and CSS media queries to adjust the layout for different
screen sizes.
Example:
### 17. What are the new input types introduced in HTML5?
HTML5 introduced several new input types, including email, url, number, date, color, and range.
The <iframe> tag is used to embed another HTML document within the current document. Example:
### 20. How do you use the <video> and <audio> tags?
- Video Example:
<video controls>
</video>
HTML Interview Questions with Answers
- Audio Example:
<audio controls>
</audio>