What is HTML?
What does HTML stand for?
HTML stands for HyperText Markup Language.
What is the purpose of HTML?
HTML structures web content and defines the layout of web pages.
What is the latest version of HTML?
HTML5 is the latest version of HTML.
What is a tag in HTML?
Tags are keywords enclosed in angle brackets (< >) used to define HTML elements and structure content on web pages.
What is an HTML element?
An HTML element consists of a start tag, content, and an end tag. For example, <p>Hello</p> is a paragraph element.
What are attributes in HTML?
Attributes provide additional information about HTML elements and are defined in the opening tag (e.g., <img src="image.jpg">).
What is the purpose of the <!DOCTYPE> declaration?
The <!DOCTYPE> declaration specifies the document type and version of HTML used in the page, helping browsers render it correctly.
What is the <html> tag used for?
The <html> tag is the root element that wraps the entire HTML document.
What is the <head> section in HTML?
The <head> section contains metadata, such as the page title, linked resources (e.g., CSS files), and other information not displayed directly on the page.
What is the purpose of the <title> tag?
The <title> tag sets the title of the web page, which is displayed in the browser tab.
What is the <body> tag used for?
The <body> tag contains the visible content of the webpage, including text, images, and links.
What is a self-closing tag in HTML?
A self-closing tag is an HTML element that doesn’t need a closing tag, such as <img>, <br>, or <hr>.
What is a block-level element?
Block-level elements, like <div>, <p>, and <h1>, take up the entire width of their container.
What is an inline element?
Inline elements, such as <span>, <a>, and <em>, only take up as much space as their content requires, allowing them to sit within a block-level element.
What are semantic HTML elements?
Semantic elements clearly describe their meaning in a human-readable way, such as <header>, <article>, <footer>, and <section>.
What is the difference between HTML and XHTML?
XHTML is a stricter version of HTML that requires tags to be properly closed and attributes to be quoted.
What is the <a> tag used for?
The <a> tag creates hyperlinks to navigate between web pages or other resources.
What does the href attribute in the <a> tag do?
The href attribute specifies the URL of the link destination.
What is the <img> tag used for?
The <img> tag embeds an image into a webpage.
What does the alt attribute in the <img> tag do?
The alt attribute provides alternative text for an image if it fails to load and improves accessibility for screen readers.
How do you create an ordered list in HTML?
Use the <ol> tag for ordered lists and <li> tags for each list item.
How do you create an unordered list in HTML?
Use the <ul> tag for unordered lists and <li> for list items.
What is the <div> tag used for?
The <div> tag is a block-level element used as a container for grouping other HTML elements.
What is the <span> tag used for?
The <span> tag is an inline element used to group text or other elements for styling purposes.
How do you create a table in HTML?
Use the <table> tag to create a table, along with <tr> for rows, <th> for headers, and <td> for data cells.
What is the purpose of the <form> tag in HTML?
The <form> tag is used to create a form for user input, often for collecting and submitting data to a server.
What is the role of the action attribute in a <form> tag?
The action attribute specifies the URL where the form data will be sent when submitted.
What is the method attribute in the <form> tag?
The method attribute specifies the HTTP method used to send form data, either GET or POST.
What is the difference between GET and POST methods in a form?
GET sends form data in the URL and is less secure, while POST sends form data in the HTTP request body, making it more secure for sensitive information.
What are <input> elements used for in forms?
The <input> element is used to create input fields such as text fields, radio buttons, checkboxes, and submit buttons.
What is the difference between the name and id attributes in an HTML form?
The name attribute is used to identify form data when submitted, while the id attribute uniquely identifies an element within the document for styling or scripting.
What is the <label> tag used for?
The <label> tag provides a description for an <input> element, improving accessibility by linking text to form controls.
What is the <meta> tag used for?
The <meta> tag provides metadata about the HTML document, such as character encoding, viewport settings, and SEO-related data.
What is the viewport meta tag used for?
The viewport meta tag controls how a web page is displayed on mobile devices by setting the width and scale of the viewport.
What is the difference between the <strong> and <b> tags?
The <strong> tag represents strong importance, while the <b> tag is used purely for bold formatting.
What is the difference between the <em> and <i> tags?
The <em> tag represents emphasis, making text italic with semantic meaning, while the <i> tag is used for purely italic formatting.
How do you embed a video in HTML?
Use the <video> tag along with the src attribute to embed a video file.
What is the <iframe> tag used for?
The <iframe> tag embeds another HTML document or external content, such as a video or another webpage, within the current page.
What is the alt attribute used for in images?
The alt attribute provides alternative text for an image to describe its content, especially for screen readers and when the image fails to load.