๐ŸŽจ

HTML & CSS Interview Questions

122 questions ยท Semantic HTML, Flexbox, Grid, responsive design and accessibility questions.

122 results

1
HTML/CSSBeginner#html#semantics

What is semantic HTML and why does it matter?

Open
2
HTML/CSSBeginner#html#elements

What is the difference between <div> and <span>?

Open
3
HTML/CSSBeginner#html#doctype

What does the DOCTYPE declaration do?

Open
4
HTML/CSSIntermediate#html#doctype

What is quirks mode vs standards mode?

Open
5
HTML/CSSBeginner#html#meta

What are the important meta tags in an HTML document?

Open
6
HTML/CSSBeginner#html#meta

What does the viewport meta tag do and why is it needed?

Open
7
HTML/CSSIntermediate#html#performance

What is the difference between <script>, <script async>, and <script defer>?

Open
8
HTML/CSSBeginner#html#forms

What HTML5 form input types do you know?

Open
9
HTML/CSSIntermediate#html#forms

How do you validate a form using native HTML attributes?

Open
10
HTML/CSSBeginner#html#forms

What is the difference between GET and POST form methods?

Open
11
HTML/CSSBeginner#html#forms

What is the purpose of the <label> element and how should it be associated with inputs?

Open
12
HTML/CSSBeginner#html#tables

How do you build a table with a header, body, and footer?

Open
13
HTML/CSSIntermediate#html#tables

How do colspan and rowspan work in tables?

Open
14
HTML/CSSBeginner#html#media

How do you embed audio and video with fallback controls?

Open
15
HTML/CSSIntermediate#html#media

What is the <picture> element used for?

Open
16
HTML/CSSAdvanced#html#media

What is srcset and sizes used for on <img>?

Open
17
HTML/CSSBeginner#html#semantics

What is the difference between <b>/<i> and <strong>/<em>?

Open
18
HTML/CSSIntermediate#accessibility#aria

What is ARIA and when should you use it?

Open
19
HTML/CSSAdvanced#accessibility#aria

How do you make a custom dropdown accessible?

Open
20
HTML/CSSAdvanced#accessibility

What is the accessibility tree and how does it relate to the DOM?

Open
21
HTML/CSSBeginner#accessibility#html

How do you ensure images are accessible?

Open
22
HTML/CSSIntermediate#accessibility

What is keyboard accessibility and how do you test for it?

Open
23
HTML/CSSBeginner#seo#html

What are the basic on-page SEO practices in HTML?

Open
24
HTML/CSSAdvanced#seo#html

What is structured data / Schema.org markup used for?

Open
25
HTML/CSSIntermediate#storage#javascript

What is the difference between localStorage, sessionStorage, and cookies?

Open
26
HTML/CSSAdvanced#storage#javascript

What is IndexedDB used for?

Open
27
HTML/CSSAdvanced#storage#pwa

What is the Cache API and how does it relate to Service Workers?

Open
28
HTML/CSSIntermediate#css#specificity

What is CSS specificity and how is it calculated?

Open
29
HTML/CSSBeginner#css#box-model

What is the CSS box model?

Open
30
HTML/CSSBeginner#css#box-model

What is the difference between margin and padding?

Open
31
HTML/CSSAdvanced#css#box-model

What is margin collapsing?

Open
32
HTML/CSSBeginner#css#display

Explain the different values of the display property.

Open
33
HTML/CSSBeginner#css#display

What is the difference between visibility: hidden and display: none?

Open
34
HTML/CSSIntermediate#css#position

Explain the CSS position property values.

Open
35
HTML/CSSIntermediate#css#position

How does position: sticky work?

Open
36
HTML/CSSIntermediate#css#float

What is the CSS float property used for and what problems does it cause?

Open
37
HTML/CSSAdvanced#css#float

How do you clear floats without adding extra markup?

Open
38
HTML/CSSBeginner#css#flexbox

Explain Flexbox: main axis vs cross axis.

Open
39
HTML/CSSIntermediate#css#flexbox

What do flex-grow, flex-shrink, and flex-basis do?

Open
40
HTML/CSSBeginner#css#flexbox

How do you center a div both horizontally and vertically?

Open
41
HTML/CSSIntermediate#css#layout-puzzle

How do you build a sticky footer that stays at the bottom even with little content?

Open
42
HTML/CSSBeginner#css#grid

Explain CSS Grid: grid-template-columns/rows and fr unit.

Open
43
HTML/CSSAdvanced#css#grid

How do you create a responsive grid without media queries using auto-fit/auto-fill?

Open
44
HTML/CSSIntermediate#css#grid

What is the difference between Flexbox and Grid, and when should you use each?

Open
45
HTML/CSSIntermediate#css#grid

What are grid-template-areas used for?

Open
46
HTML/CSSBeginner#css#responsive

What are CSS media queries and how do you write a mobile-first stylesheet?

Open
47
HTML/CSSIntermediate#css#responsive

What is the difference between responsive and adaptive design?

Open
48
HTML/CSSBeginner#css#units

What are the different CSS units (px, em, rem, %, vw, vh) and when to use them?

Open
49
HTML/CSSIntermediate#css#variables

What are CSS custom properties (variables) and how do you use them?

Open
50
HTML/CSSBeginner#css#selectors

What is the difference between pseudo-classes and pseudo-elements?

Open
51
HTML/CSSIntermediate#css#selectors

Explain the :nth-child() selector with examples.

Open
52
HTML/CSSIntermediate#css#selectors

What CSS attribute selectors are available?

Open
53
HTML/CSSIntermediate#css#selectors

What is the difference between adjacent sibling (+) and general sibling (~) combinators?

Open
54
HTML/CSSBeginner#css#transitions

How do CSS transitions work?

Open
55
HTML/CSSIntermediate#css#animations

How do CSS keyframe animations work?

Open
56
HTML/CSSIntermediate#css#transforms

What CSS transform functions are commonly used?

Open
57
HTML/CSSAdvanced#css#performance

Why should you animate transform/opacity instead of top/left/width for performance?

Open
58
HTML/CSSAdvanced#css#z-index

What is the z-index property and how does stacking context work?

Open
59
HTML/CSSAdvanced#css#stacking-context

What creates a new stacking context in CSS?

Open
60
HTML/CSSIntermediate#css#bem

What is BEM methodology?

Open
61
HTML/CSSAdvanced#css#methodology

What are other CSS methodologies besides BEM (OOCSS, SMACSS, ITCSS)?

Open
62
HTML/CSSIntermediate#css#sass

What are CSS preprocessors and what problems do they solve?

Open
63
HTML/CSSAdvanced#css#sass

What is the difference between a Sass mixin and a placeholder/extend?

Open
64
HTML/CSSBeginner#css#tailwind

What is Tailwind CSS and how does it differ from writing custom CSS?

Open
65
HTML/CSSIntermediate#css#tailwind

How do you customize and extend Tailwind's default theme?

Open
66
HTML/CSSBeginner#css#tailwind

What are Tailwind's responsive and state variant prefixes?

Open
67
HTML/CSSAdvanced#css#cross-browser

What are common cross-browser compatibility issues in CSS and how do you handle them?

Open
68
HTML/CSSBeginner#css#cross-browser

What is a CSS reset or normalize.css and why use one?

Open
69
HTML/CSSAdvanced#css#performance

What is critical CSS and how does it improve page performance?

Open
70
HTML/CSSIntermediate#css#performance

What are CSS sprites and why were/are they used?

Open
71
HTML/CSSAdvanced#css#performance

What other CSS performance best practices should you follow?

Open
72
HTML/CSSIntermediate#css#layout-puzzle

How do you implement a full-height sticky sidebar next to scrolling content?

Open
73
HTML/CSSBeginner#css#flexbox

How do you create equal-height columns?

Open
74
HTML/CSSIntermediate#css#layout-puzzle

How do you truncate text with an ellipsis, including multi-line clamping?

Open
75
HTML/CSSIntermediate#css#responsive

How do you create a responsive image that maintains aspect ratio without JavaScript?

Open
76
HTML/CSSIntermediate#css#cascade

What is the CSS cascade and how is rule conflict order determined?

Open
77
HTML/CSSIntermediate#css#cascade

What does !important do and why should it generally be avoided?

Open
78
HTML/CSSIntermediate#css#pseudo-elements

What is the CSS 'content' property used for with pseudo-elements?

Open
79
HTML/CSSBeginner#css#display

What is the difference between inline, inline-block, and block for form control styling?

Open
80
HTML/CSSAdvanced#css#internationalization

How do CSS logical properties (like margin-inline, padding-block) differ from physical properties?

Open
81
HTML/CSSIntermediate#css#functions

How does the CSS calc() function work?

Open
82
HTML/CSSAdvanced#css#functions

What is the difference between min(), max(), and clamp() in CSS?

Open
83
HTML/CSSBeginner#css#overflow

What is the difference between overflow: visible, hidden, scroll, and auto?

Open
84
HTML/CSSIntermediate#css#units

What is the difference between em and rem when nesting components?

Open
85
HTML/CSSIntermediate#css#variables

How would you implement a dark mode toggle using CSS?

Open
86
HTML/CSSIntermediate#css#position

What is the difference between absolute and fixed positioning in terms of containing block?

Open
87
HTML/CSSBeginner#css#flexbox

What is the CSS 'gap' property and how does it simplify spacing in flex/grid layouts?

Open
88
HTML/CSSBeginner#css#selectors

What is the difference between class selectors and ID selectors, and why avoid IDs for styling?

Open
89
HTML/CSSAdvanced#css#layout-puzzle

How do you build a CSS-only accordion or tab component?

Open
90
HTML/CSSAdvanced#css#grid

What is the 'holy grail' layout and how is it built with Grid?

Open
91
HTML/CSSAdvanced#css#units

What is the difference between relative units vw/vh and %?

Open
92
HTML/CSSBeginner#css#box-model

What is the box-sizing property and why is border-box generally preferred?

Open
93
HTML/CSSBeginner#css#pseudo-classes

What is the difference between :hover, :focus, and :active pseudo-classes?

Open
94
HTML/CSSAdvanced#css#pseudo-classes

What is the difference between :focus and :focus-visible?

Open
95
HTML/CSSIntermediate#css#accessibility

How do you make an SVG icon accessible and stylable with CSS?

Open
96
HTML/CSSAdvanced#css#responsive

What is the difference between em/rem and viewport-relative clamp() for fluid typography?

Open
97
HTML/CSSAdvanced#css#responsive

What are container queries and how do they differ from media queries?

Open
98
HTML/CSSIntermediate#css#performance

How do you prevent Cumulative Layout Shift (CLS) caused by images and ads?

Open
99
HTML/CSSBeginner#css#fundamentals

What is the difference between inline styles, internal <style>, and external stylesheets?

Open
100
HTML/CSSBeginner#css#selectors

What is the universal selector (*) and what are its performance implications?

Open
101
HTML/CSSIntermediate#css#forms

How do you style form validation states using CSS pseudo-classes?

Open
102
HTML/CSSAdvanced#css#design-systems

What is the difference between rem-based spacing scale and arbitrary pixel values in design systems?

Open
103
HTML/CSSAdvanced#css#performance

How does the 'will-change' property affect rendering performance?

Open
104
HTML/CSSIntermediate#html#semantics

What is the difference between HTML5's <section>, <article>, and <aside>?

Open
105
HTML/CSSBeginner#html#structure

What is the difference between the <head> and <body> sections of an HTML document?

Open
106
HTML/CSSBeginner#html#accessibility

What is the purpose of the alt attribute versus the title attribute on images?

Open
107
HTML/CSSBeginner#html#javascript

What is a data attribute and how is it used?

Open
108
HTML/CSSBeginner#html#elements

What is the difference between <ul>, <ol>, and <dl>?

Open
109
HTML/CSSAdvanced#css#media-queries

How do you make a webpage print-friendly using CSS?

Open
110
HTML/CSSIntermediate#css#media

What is the CSS 'object-fit' property used for?

Open
111
HTML/CSSBeginner#html#entities

What is the difference between HTML entities and Unicode characters?

Open
112
HTML/CSSBeginner#html#attributes

What is the difference between the id and class attributes?

Open
113
HTML/CSSAdvanced#html#javascript

What is the <template> element used for?

Open
114
HTML/CSSAdvanced#html#security

What is the difference between the <iframe> sandbox attribute values?

Open
115
HTML/CSSIntermediate#html#performance

How do you lazy-load images natively in HTML?

Open
116
HTML/CSSAdvanced#css#layout

What is the difference between a block formatting context (BFC) and normal flow?

Open
117
HTML/CSSIntermediate#css#accessibility

What is the difference between resetting focus outlines and providing accessible focus styles?

Open
118
HTML/CSSAdvanced#css#grid

What is the difference between CSS Grid's implicit and explicit grid?

Open
119
HTML/CSSBeginner#css#layout-puzzle

How do you vertically center text inside a single-line button using CSS?

Open
120
HTML/CSSIntermediate#css#tailwind

What is the difference between a CSS framework like Bootstrap and a utility-first framework like Tailwind?

Open
121
HTML/CSSAdvanced#css#units

What is the difference between static and dynamic viewport units (vh vs dvh)?

Open
122
HTML/CSSIntermediate#css#cross-browser

How do you handle browser-specific CSS prefixes and why is Autoprefixer useful?

Open