1. What is HTML and what are its key features?
HTML (HyperText Markup Language) is the standard language for creating web pages. Its key features include the use of tags to structure content, support for multimedia elements (like images, audio, and video), forms for user input, and the ability to link to other web pages via hyperlinks.
2. What is the difference between HTML and XHTML?
HTML is more flexible with syntax rules and is not case-sensitive, while XHTML (Extensible HyperText Markup Language) is stricter, requiring elements to be properly nested, closed, and in lowercase. XHTML is an XML-based language, ensuring a more consistent and well-formed document structure.
3. What are semantic HTML elements and why are they important?
Semantic HTML elements clearly describe their meaning in a human- and machine-readable way. Examples include
<header>, <footer>, <article>, and <section>. They improve accessibility, SEO, and code readability by providing meaningful structure to the content.4. How do you create a hyperlink in HTML?
A hyperlink is created using the
<a> (anchor) tag with the href attribute specifying the URL of the link. For example:<a href="https://www.example.com">Visit Example</a>
5. What are HTML forms and how do you create one?
HTML forms are used to collect user input and are created using the
<form> tag. Forms contain various input elements like text fields, radio buttons, checkboxes, and submit buttons. For example:<form action="/submit" method="post">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="Submit">
</form>
6. Explain the difference between the
<div> and <span> tags.The
<div> tag is a block-level element used to group larger sections of content, creating distinct blocks. The <span> tag is an inline element used to group small portions of text or other inline elements. <div> typically affects the layout by creating line breaks, while <span> does not.7. What is the purpose of the
<meta> tag in HTML?The
<meta> tag provides metadata about the HTML document, such as character encoding, viewport settings for responsive design, and SEO-related information like descriptions and keywords. Meta tags are placed within the <head> section of the HTML document.8. How do you include an image in an HTML page?
An image is included using the
<img> tag with the src attribute specifying the path to the image file and the alt attribute providing alternative text for accessibility. For example:<img src="image.jpg" alt="Description of image">
9. What is the difference between inline, inline-block, and block elements in HTML?
- Inline elements (e.g.,
<span>, <a>) do not start on a new line and only take up as much width as necessary.- Block elements (e.g.,
<div>, <p>) start on a new line and take up the full width available.- Inline-block elements (e.g.,
<img>) are similar to inline elements but allow setting width and height, behaving like a combination of inline and block elements.10. How do you embed a video in an HTML page?
A video is embedded using the
<video> tag with the src attribute specifying the video file. You can include optional attributes like controls for playback controls and autoplay to start playing the video automatically. For example:<video src="video.mp4" controls>
Your browser does not support the video tag.
</video>
Free Web Development Resources: https://t.me/webdevcoursefree
Join @free4unow_backup for more free resources.
ENJOY LEARNING! 👍👍