TGViewer
Coding Interview Resources Coding Interview Resources @crackingthecodinginterview · 52.1K subscribers
Post #1034 6.4K
Top 10 HTML Interview Questions

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! 👍👍
  • 👍 6
  • ❤ 2
More from @crackingthecodinginterview
  1. Oct 18, 2026𝟰 𝗙𝗥𝗘𝗘 𝗖𝗼𝘂𝗿𝘀𝗲𝘀 𝗧𝗼 𝗠𝗮𝘀𝘁𝗲𝗿 𝗖𝗼𝗱𝗶𝗻𝗴 𝗙𝗼𝗿 𝗙𝗥𝗘𝗘😍 ✅ 100% FREE Yo…
  2. Oct 17, 2026𝗜𝗕𝗠 𝗙𝗥𝗘𝗘 𝗧𝗘𝗖𝗛 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝟮𝟬𝟮𝟲! 🎓 Explore IBM Cognitive Class and build…
  3. Oct 16, 2026𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍 Future Ready Data Scien…
  4. Oct 16, 2026If you're working with data pipelines, these repositories are very useful: 🚀📊 ibis: A Py…
  5. Oct 13, 2026𝗧𝗢𝗣 𝗙𝗥𝗘𝗘 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝗧𝗢 𝗕𝗢𝗢𝗦𝗧 𝗬𝗢𝗨𝗥 𝗦𝗞𝗜𝗟𝗟𝗦 𝗜𝗡 𝟮𝟬𝟮𝟲! Explor…
  6. Oct 12, 2026🚀 𝗪𝗵𝗶𝗰𝗵 𝗧𝗲𝗰𝗵 𝗦𝗸𝗶𝗹𝗹 𝗪𝗶𝗹𝗹 𝗬𝗼𝘂 𝗠𝗮𝘀𝘁𝗲𝗿 𝗶𝗻 𝟮𝟬𝟮𝟲? Want to buil…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →