General Questions on HTML
1. What is HTML?
o HTML (HyperText Markup Language) is the standard markup
language for creating web pages.
2. What is the latest version of HTML?
o HTML5.
3. What are some key features of HTML5?
o Semantics, Connectivity, Offline storage, Multimedia support,
2D/3D graphics, Device access, Styling, and Performance
improvements.
4. What are semantic elements in HTML5?
o Elements that clearly describe their meaning (e.g., <article>,
<section>, <header>, <footer>).
5. How does HTML5 improve multimedia support?
o By introducing <audio> and <video> tags for embedding
media without plugins.
HTML Elements
6. What are block-level elements?
o Elements that start on a new line and take up the full width,
such as <div>, <p>, <h1>.
7. What are inline elements?
o Elements that do not start on a new line, such as <span>,
<a>, <img>.
8. What is the purpose of the <blockquote> element?
o To define a section quoted from another source.
9. What is the difference between <h1> to <h6>?
o They represent headings, with <h1> being the most
important and <h6> the least.
10.What is the <meta> tag used for?
o Provides metadata about the HTML document, such as
description, keywords, or charset.
HTML5 Attributes
11.What is the purpose of the id attribute?
o Provides a unique identifier for an HTML element.
12.How is the class attribute used?
o It groups multiple elements for styling or scripting.
13.What is the title attribute?
o Provides additional information about an element, displayed
as a tooltip.
14.What is the difference between name and id attributes?
o id is unique, while name can be shared among multiple
elements.
15.What does the download attribute do in an <a> tag?
o Specifies that the linked file should be downloaded when
clicked.
HTML Forms
16.What are form attributes in HTML?
o action, method, enctype, and target.
17.What is the difference between get and post methods in
forms?
o GET: Appends data to the URL, suitable for retrieval.
POST: Sends data as a request body, suitable for secure data
submission.
18.What does the <input type="hidden"> element do?
o Stores data that is not visible to users but is sent with the
form.
19.What is the <fieldset> element used for?
o Groups related elements in a form.
20.What is the purpose of the <button> element?
o Creates clickable buttons with types like submit, reset, or
button.
Hyperlinks
21.What is the difference between mailto: and tel: in
hyperlinks?
o mailto: opens an email client, while tel: initiates a phone call.
22.What does the target="_blank" attribute do?
o Opens the link in a new tab or window.
23.How can you create an anchor link in HTML?
o Use <a href="#id"> to link to an element with the
corresponding id.
HTML Scripting and Events
24.What is the <script> tag used for?
o Embeds or references JavaScript in an HTML document.
25.What does the <noscript> tag do?
o Provides alternative content for users with JavaScript
disabled.
26.What is an event attribute in HTML?
o Attributes like onclick, onchange, or onmouseover that trigger
JavaScript code on events.
27.What is the difference between onkeydown and onkeyup
events?
o onkeydown: Fires when a key is pressed.
onkeyup: Fires when a key is released.
28.What is the purpose of the onload event?
o Executes JavaScript code when a page or an element is fully
loaded.
HTML5 New Features
29.What are new input types introduced in HTML5?
o email, tel, url, date, range, color, etc.
30.What is the <canvas> element?
o A container for 2D graphics drawn using JavaScript.
31.What is the <progress> element used for?
o Represents the progress of a task.
32.How does the <datalist> element work?
o Provides a list of predefined options for an input element.
33.What is the <output> element?
o Represents the result of a calculation.
Advanced Questions
34.What are global attributes in HTML?
o Attributes that apply to all elements, such as class, id, style,
title.
35.What are deprecated tags in HTML5?
o Tags like <font>, <center>, <big>, and <strike> are no
longer supported.
36.What is the purpose of the <base> tag?
o Specifies the base URL for all relative links in a document.
37.How do you include external CSS and JavaScript in an HTML
document?
o Use <link> for CSS and <script> for JavaScript.
38.What is the purpose of the async and defer attributes in
<script>?
o async: Loads the script asynchronously.
defer: Delays script execution until after the page loads.
39.How do you specify a language for a web page in HTML?
o Use the lang attribute in the <html> tag (e.g., <html
lang="en">).
40.What is the difference between <section> and <div>?
o <section> has semantic meaning, <div> does not.
Let me know if you need further advanced questions or detailed answers!