1.What is HTML?
- HTML stands for HyperText Markup Language. It is the standard markup language used to create and design web pages.
2.What is the purpose of HTML tags?
- HTML tags are used to define and describe the content of a web page. They structure the content and provide a set of instructions to the browser on how to display the content.
3.What is the basic structure of an HTML document?
- An HTML document typically consists of a
<!DOCTYPE html>declaration, an<html>element containing<head>and<body>sections.
4.Explain the difference between HTML and XHTML.
- HTML is more forgiving in terms of syntax errors, while XHTML is stricter and requires well-formed documents. XHTML documents must be properly nested, and all tags must be closed.
5.What is the purpose of the
alt attribute in an img tag?- The
altattribute provides alternative text for an image, which is displayed if the image cannot be loaded. It also improves accessibility for users with disabilities.
6.How do you create a hyperlink in HTML?
- Hyperlinks are created using the
<a>(anchor) tag. For example:<a href="https://example.com">Visit Example</a>.
7.Explain the difference between
block and inline elements.- Block elements start on a new line and take up the full width available, while inline elements do not start on a new line and only take up as much width as necessary.
8.What is the purpose of the
DOCTYPE declaration?- The
DOCTYPEdeclaration defines the document type and version of HTML being used. It helps browsers to render the document correctly.
9.What are semantic elements in HTML? Provide examples.
- Semantic elements convey the meaning of the content they enclose. Examples include
<header>,<footer>,<article>,<section>,<nav>, and<aside>.
10.Explain the difference between the
<div> and <span> elements.<div>is a block-level element used to group other elements and apply styles, while<span>is an inline element used for applying styles to a specific portion of text.
11.How can you embed a video in HTML?
- The
<video>element is used to embed videos. Example:<video src="example.mp4" controls></video>.
12.What is the purpose of the
meta tag in HTML?- The
metatag is used to provide metadata about the HTML document, such as character set, viewport settings, and keywords for search engines.
13.Explain the difference between
GET and POST methods in HTML forms.GETis used for requests where data is appended to the URL, whilePOSTis used when data is sent in the body of the request.POSTis more secure and suitable for sensitive data.
14.What is the purpose of the
id and class attributes in HTML?- The
idattribute provides a unique identifier for an element, while theclassattribute is used to group elements and apply styles to multiple elements with the same class.
15.How do you create a numbered list and a bulleted list in HTML?
- Numbered list:
<ol><li>Item 1</li><li>Item 2</li></ol> - Bulleted list:
<ul><li>Item A</li><li>Item B</li></ul>
16.What is the purpose of the
<iframe> tag?- The
<iframe>tag is used to embed another document within the current HTML document. It is commonly used for embedding videos, maps, or other external content.
17.Explain the purpose of the
<head> section in an HTML document.- The
<head>section contains meta-information about the HTML document, such as title, character set, stylesheets, and scripts. It doesn't directly contribute to the visible content of the page.
18.What is the purpose of the
colspan and rowspan attributes in a table?colspanis used to make a cell span multiple columns, androwspanis used to make a cell span multiple rows in a table.
19.What is the purpose of the
localStorage in HTML5?localStorageis a web storage API that allows you to store key-value pairs in a web browser with no expiration time. It provides a way to persistently store data on the client side.
Comments
Post a Comment