Frontend Development

Top HTML5 & CSS3 Questions for 2025 Interviews

By JobQNA Team • Updated: Jan 18, 2025

Frontend interviews aren't just about JavaScript. You can't build a website without a solid understanding of HTML structure and CSS layout. Here are the most critical concepts you need to know.


1. What are Semantic Tags in HTML5?

Semantic tags clearly describe their meaning to both the browser and the developer. They are crucial for SEO and Accessibility (Screen Readers).

<!-- Non-semantic -->
<div id="header"></div>

<!-- Semantic -->
<header></header>
<nav></nav>
<article></article>
<footer></footer>

2. Explain the CSS Box Model

Every element on a web page is essentially a rectangular box. The box model consists of four parts:

Interview Tip: Always mention box-sizing: border-box;. It ensures that padding and border are included in the element's total width/height, making layout calculations much easier.

3. Flexbox vs. CSS Grid: When to use which?

This is the most confusing topic for beginners.

Flexbox (1D Layout)

Use Flexbox when you want to arrange items in a single row OR a single column. It's perfect for navigation bars, centering items, or aligning buttons.

.container {
  display: flex;
  justify-content: center;
  align-items: center;
}

CSS Grid (2D Layout)

Use Grid when you need to control both rows AND columns at the same time. It's best for full page layouts, photo galleries, or dashboard structures.

4. The Classic Question: How to Center a Div?

Before Flexbox, this was hard. Now, it's just 3 lines of code.

.parent {
  display: flex;
  justify-content: center; /* Horizontal */
  align-items: center; /* Vertical */
  height: 100vh;
}

5. What is CSS Specificity?

If two rules conflict, the one with higher specificity wins. The hierarchy is:

  1. Inline Styles (style="...") - Highest
  2. IDs (#header)
  3. Classes (.btn), Attributes, Pseudo-classes
  4. Elements (div, h1) - Lowest
Need a quick reference? Check our full CSS Cheat Sheet for all properties.

Conclusion

Mastering layouts with Flexbox/Grid and understanding the Box Model are the two most important skills for a UI developer. Practice building a simple landing page to test your knowledge.