1. What is the purpose of the <!DOCTYPE html> declaration in HTML5?

Answer: The <!DOCTYPE html> declaration is used to specify to the browser which version of HTML the page is written in. In HTML5, it tells the browser that the page is written in the HTML5 standard.

2. Explain the difference between <div> and <span> tags in HTML.

Answer: <div> and <span> are both used as container elements, but they have different default display properties.

Div ( <div> ) : 1) Block level Element 2)Start with New Line 3)Full Width

Span( <span> ) : 1) Inline element 2) It does not start on a new line 3)Takes up as much width as necessary

3. Semantic HTML elements with some examples..

Answer: Semantic HTML elements are those that carry meaning beyond just presentation. They provide information about the content they contain, making the code more understandable for both developers and browsers. Examples include

In this example:

  • <header>: Represents the introductory content of the page, often containing a logo, navigation menu, etc.
  • <nav>: Defines a navigation section.
  • <main>: Contains the main content of the webpage.
  • <article>: Represents a self-contained piece of content, such as a blog post, article, or news story.
  • <section>: Defines sections within a document, such as chapters, headers, footers, or any other thematic grouping.
  • <footer>: Represents the footer of a document or section, typically containing copyright information, contact details, etc.