All 46 questions
How do display: none, visibility: hidden, and display: block differ?
Asked in 5 of 201 interviews · last asked Oct 25 · Concept · Junior
Show answer
`display: none` hides an element and removes its space from the layout. `visibility: hidden` hides it but keeps its space. `display: block` makes it a block-level element, which starts on a new line in normal flow. It does not make the element visible if `visibility: hidden` still applies.
- `display: none` removes layout boxes for the element and its descendants.
- `visibility: hidden` keeps the element’s size and position in the layout.
- `display: block` controls layout; `visibility` controls whether the element is shown.
What the interviewer checks: The interviewer checks whether you understand the difference between hiding content and removing its layout space.
Other ways it was asked
- “What is the difference between CSS `display: none` and `visibility: hidden`?”
- “What is the difference between display: none and visibility: hidden?”
- “What is the difference between `display: block` and `visibility: hidden` in CSS?”
What is the difference between ID and class selectors in CSS?
Asked in 3 of 201 interviews · last asked Nov 19 · Concept · Junior
Show answer
An ID selector uses # to match an element’s id, which must be unique on the page. A class selector uses . to match a class name, which many elements can share. An element can have several classes. An ID selector has higher specificity than a class selector.
- Use IDs for unique elements and classes for reusable styles.
- An element can have one ID and multiple classes.
- Higher specificity wins when competing declarations have the same origin, importance, and cascade layer.
CodeHTML: <div id="intro" class="card featured">Welcome</div> <div class="card">More content</div> CSS: .card { color: blue; } #intro { color: red; }What the interviewer checks: The interviewer is checking selector syntax, ID uniqueness, class reuse, and specificity.
Other ways it was asked
- “Can you complete your explanation on the difference between ID and class selectors in CSS?”
- “What is the difference between an ID and a class in CSS?”
- “In CSS, which has higher specificity: a class selector or an ID selector?”
What is the CSS box model?
Asked in 3 of 201 interviews · last asked Oct 1 · Concept · Junior
Show answer
The CSS box model describes an element as a box with four parts: content, padding, border, and margin. Content holds text or images. Padding is the space between the content and border. Margin is the space outside the border.
- With the default box-sizing: content-box, width and height apply only to the content.
- With box-sizing: border-box, width and height include content, padding, and border.
- Margin is outside the box and is not included in either sizing mode.
What the interviewer checks: The interviewer is checking whether you understand element spacing and how CSS calculates box sizes.
Other ways it was asked
- “What is the CSS box model, and how does CSS Grid work?”
What is CSS?
Asked in 2 of 201 interviews · last asked Aug 4 · Concept · Junior
Other ways it was asked
- “Explain CSS in your own words.”
What is margin collapsing in CSS, and how can you control or prevent it?
Asked in 2 of 201 interviews · last asked Aug 25 · Concept · Junior
Other ways it was asked
- “How can you control or prevent CSS margin collapsing?”
- “What is margin collapse in CSS?”
- “What is CSS margin collapsing, and when does it occur?”
What is the purpose of the background color property in CSS?
Asked in 2 of 201 interviews · last asked Oct 26 · Concept · Junior
Other ways it was asked
- “What is the purpose of the color property in CSS?”
How do you change the text color of a paragraph or the background color of a div in CSS?
Asked in 2 of 201 interviews · last asked Oct 26 · Tooling · Junior
Explain the difference between margin and padding.
Asked in 2 of 201 interviews · last asked Aug 20 · Concept · Junior
Other ways it was asked
- “What is the difference between padding and margin in CSS?”
Which CSS properties can you use to control the spacing between boxes?
Asked once · last asked Mar 20 · Concept · Junior
How can you distinguish padding from margin in the CSS box model?
Asked once · last asked Mar 20 · Concept · Junior
In the CSS box model, what lies outside an element's border?
Asked once · last asked Mar 20 · Concept · Junior
What is the difference between relative, absolute, and fixed positioning in CSS?
Asked once · last asked Jul 27 · Concept · Junior
Other ways it was asked
- “Could you explain how absolute positioning behaves compared to relative and fixed positioning?”
What does CSS stand for, and how does CSS work with HTML to control a website's appearance?
Asked once · last asked Jul 27 · Concept · Junior
What's the difference between content-box and border-box in the CSS box model?
Asked once · last asked Aug 25 · Concept · Junior
What is the difference between display none, visibility hidden, and opacity zero?
Asked once · last asked Aug 25 · Concept · Mid-level
How does an element with opacity: 0 affect page layout, and what should you consider when using it?
Asked once · last asked Aug 25 · Concept · Mid-level
Could you talk about positioning — static, relative, absolute, fixed, and sticky?
Asked once · last asked Aug 25 · Concept · Mid-level
If a parent has position relative, where is an absolute child positioned: relative to the parent or the whole document?
Asked once · last asked Aug 25 · Concept · Mid-level
What is CSS specificity, and how is it determined?
Asked once · last asked Aug 25 · Concept · Junior
How can you prevent text from overflowing its container in a web interface?
Asked once · last asked Oct 2 · Scenario · Mid-level
What is the difference between px and rem?
Asked once · last asked Oct 9 · Concept · Junior
What do the CSS :has() and :is() pseudo-classes do, and how do they differ?
Asked once · last asked Oct 12 · Concept · Mid-level
Other ways it was asked
- “What is the purpose of :has()? When do you use it?”
- “What is the difference between the CSS :has() and :is() pseudo-classes?”
How would you write a CSS rule to make an Apply button blue only on one page when it is red across the rest of the site?
Asked once · last asked Nov 19 · Write code · Junior
A CSS rule intended to make a button blue is not taking effect. What could cause this, and how would you diagnose and fix it?
Asked once · last asked Nov 19 · Scenario · Junior
How would you resolve a conflict between a site-wide CSS rule that makes every button red and a rule that should make one button blue?
Asked once · last asked Nov 19 · Scenario · Junior
What CSS syntax would you use to increase the font size of text in a paragraph?
Asked once · last asked May 19 · Write code · Junior
What does box-sizing: border-box do?
Asked once · last asked Jun 5 · Concept · Junior
Why do we need CSS?
Asked once · last asked Nov 21 · Concept · Junior
Who proposed CSS, and in what year was it first introduced?
Asked once · last asked Jul 22 · Concept · Junior
What are the types of CSS?
Asked once · last asked Aug 13 · Concept · Junior
How do you set a div's background color in CSS?
Asked once · last asked Aug 20 · Tooling · Junior
How do padding and margin affect an element's background or positioning differently?
Asked once · last asked Aug 20 · Concept · Junior
Can CSS use HTML data attributes in selectors?
Asked once · last asked Aug 25 · Concept · Junior
What are CSS floats, and how are they used for layout?
Asked once · last asked Aug 25 · Concept · Junior
In the CSS cascade, which takes precedence when an inline style conflicts with a stylesheet rule?
Asked once · last asked Aug 25 · Concept · Junior
What is the difference between display and visibility in CSS?
Asked once · last asked Aug 27 · Concept · Junior
What is the difference between a block-level element and an inline element in normal page layout?
Asked once · last asked Sep 15 · Concept · Junior
What does the z-index property do in CSS, and when would you use it?
Asked once · last asked Sep 28 · Concept · Junior
Can CSS select a previous sibling element, and which selector would you use?
Asked once · last asked Oct 2 · Concept · Mid-level
How do you set rounded corners on an element using CSS?
Asked once · last asked Oct 9 · Concept · Junior
What are the fundamentals of CSS?
Asked once · last asked Oct 25 · Concept · Junior
How can you include CSS in a web page?
Asked once · last asked Oct 25 · Concept · Junior
How would you style buttons and a movie detail page on a website?
Asked once · last asked Oct 26 · Scenario · Junior
In CSS, what syntax do you use to select elements and assign color values?
Asked once · last asked Oct 26 · Concept · Junior
How would you change an element's color to red using a CSS stylesheet?
Asked once · last asked Nov 12 · Write code · Junior
Which character introduces an ID selector in CSS?
Asked once · last asked Nov 12 · Concept · Junior
Other ways it was asked
- “How do you select an element by ID in CSS using a single character?”
More HTML and CSS interview questions
- All HTML and CSS interview questions
- HTML Basics and Semantic HTML Interview Questions
- CSS Layout and Responsive Design Interview Questions
- DOM and Browser API Interview Questions
- Browser Networking, Storage, and Security Interview Questions
- Browser Rendering and Web Performance Interview Questions
How this list is made
Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.
Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.
The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every HTML and CSS interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.
201 interviews, 154 candidates, Oct 2025 to Nov 2026. Updated every month with new interviews.
Or add the Chrome extension