HTML is the standard markup language for creating web pages. It structures content and enables interactive and accessible websites across devices and browsers.
Last updated on:- 14th June 2023
1.
What is HTML ?
HTML (Hypertext Markup Language) is the standard markup language for creating web pages and web applications.
2.
What are the basic structure and tags of an HTML document ?
An HTML document has a basic structure consisting of the doctype declaration, html element, head element, and body element. Commonly used tags include <h1> to <h6> for headings, <p> for paragraphs, <a> for links, and <img> for images.
3.
What is the purpose of the <head> tag in HTML ?
The <head> tag in HTML is used to define the document's metadata, including the title, character encoding, linked stylesheets, and JavaScript files.
4.
What is the <div> tag used for in HTML ?
The <div> tag in HTML is a container element that is used to group other HTML elements together and apply styles or scripts to them as a group.
5.
What is the difference between inline and block-level elements in HTML ?
Inline elements are displayed inline with the surrounding content and do not start on a new line. Block-level elements, on the other hand, start on a new line and take up the full width available.
6.
What are semantic HTML elements ?
Semantic HTML elements are tags that provide meaning to the structure and content of web pages. Examples include <header>, <nav>, <article>, <section>, <aside>, and <footer>.
7.
What is the difference between the <span> and <div> tags in HTML ?
The <span> tag is an inline element used to apply styles or scripts to a specific section of text or content within a line, while the <div> tag is a block-level element used to group other elements together.
8.
What is the <a> tag used for in HTML ?
The <a> tag in HTML is used to create links to other web pages, files, or locations within the same page. It is commonly used for navigation or to provide references to related content.
9.
What is the purpose of the alt attribute in the <img> tag ?
The alt attribute in the <img> tag is used to provide alternative text for an image, which is displayed if the image cannot be loaded or for accessibility purposes.
10.
What is the difference between the <ol> and <ul> tags in HTML ?
The <ol> tag is used to create ordered lists with numbered items, while the <ul> tag is used to create unordered lists with bullet-pointed items.
11.
What is the role of the <table> tag in HTML ?
The <table> tag in HTML is used to create structured tabular data. It consists of one or more <tr> (table row) elements containing <th> (table header) or <td> (table data) cells.
12.
What is the purpose of the <form> tag in HTML ?
The <form> tag in HTML is used to create interactive forms that allow users to input and submit data. It can contain various input elements like text fields, checkboxes, radio buttons, and submit buttons.
13.
What is the role of the <head> tag in HTML ?
The <head> tag in HTML is used to define the document's metadata, including the title, character encoding, linked stylesheets, and JavaScript files.
14.
What is the <textarea> tag used for in HTML ?
The <textarea> tag in HTML is used to create a multiline input field where users can enter and edit text. It is commonly used for comments, messages, or larger blocks of text.
15.
What is the role of the <iframe> tag in HTML ?
The <iframe> tag in HTML is used to embed another HTML document or external content within the current document. It is commonly used for displaying videos, maps, or external web pages.
16.
What are the different types of form input elements in HTML ?
HTML provides various form input elements, including text fields (<input type='text'>), checkboxes (<input type='checkbox'>), radio buttons (<input type='radio'>), select dropdowns (<select>), and submit buttons (<input type='submit'>).
17.
What is the purpose of the alt attribute in the <img> tag ?
The alt attribute in the <img> tag is used to provide alternative text for an image, which is displayed if the image cannot be loaded or for accessibility purposes.
18.
What is the role of the <header> tag in HTML ?
The <header> tag in HTML is used to define the introductory content or a container for the introductory content of a section or page. It often contains headings, logos, and navigation.
19.
What is the purpose of the target attribute in the <a> tag ?
The target attribute in the <a> tag is used to specify where the linked content should be opened when the link is clicked. Common values include '_blank' (open in a new tab or window) and '_self' (open in the same tab or window).
20.
What is the role of the <footer> tag in HTML ?
The <footer> tag in HTML is used to define the footer section or a container for the footer content of a section or page. It often contains copyright information, links, and author credits.