Questions
CSS questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Transition Height from 0 to Auto in CSS
Learn why CSS cannot transition height: auto and how to create smooth expand-collapse effects using max-height and alternatives.
How to Use :not() and :first-child in CSS Selectors
Learn how to target every element except the first using CSS :not() and :first-child, with clear examples and common mistakes.
How to Use CSS content with HTML Entities in CSS
Learn why HTML entities do not work in CSS content and how to insert characters correctly with quoted text or Unicode escapes.
How to Vertically Align Elements in a Div with CSS
Learn how to vertically align images and headings inside a div using modern CSS, including flexbox and absolute positioning.
How to Vertically Align Text in a div with CSS
Learn how vertical text alignment works in CSS, why `vertical-align` fails on divs, and practical ways to center content correctly.
How to Vertically Align an Image Inside a Div in CSS
Learn how to vertically center an image inside a div using CSS, including classic techniques, browser support, and practical examples.
How to Work with CSS Pseudo-Elements (::before and ::after) in JavaScript
Learn how CSS pseudo-elements work, why JavaScript cannot directly select them, and practical ways to update ::before and ::after content.
How to Wrap Text in a HTML pre Tag
Learn how to make text wrap inside an HTML pre tag using CSS while preserving whitespace for code and debugging output.
Include One CSS File in Another with CSS @import
Learn how to include one CSS stylesheet in another using CSS @import, when it works, its performance trade-offs, and better alternatives.
Make Flexbox Children Fill Parent Height with CSS
Learn why nested Flexbox children may not fill parent height and use flex layout, stretching, and percentage sizing reliably in CSS.
Margin vs Padding in CSS: What’s the Difference and When to Use Each
Learn the difference between margin and padding in CSS, how they affect layout and spacing, and when to use each with simple examples.
Remove CSS Classes with JavaScript: classList.remove()
Learn how to remove CSS classes from HTML elements with plain JavaScript using classList.remove(), selectors, and safe fallbacks.
Remove Input Focus Outline with Accessible CSS
Learn how CSS focus outlines work on text inputs, how to style them across browsers, and how to keep keyboard navigation accessible.
SCSS vs Sass: What’s the Difference in Sass Syntax?
Learn the difference between SCSS and Sass, how their syntax works, and when to use each for writing more powerful CSS stylesheets.
Select Elements with Multiple Classes in jQuery
Learn how to select elements that have multiple CSS classes in jQuery using compound selectors, with examples, pitfalls, and practical patterns.
Set and Read Cookies in JavaScript for a CSS Theme
Learn to set, read, and expire JavaScript cookies by saving a selected CSS theme and restoring it when the page loads.
Should CSS Come Before JavaScript in HTML? Rendering and Loading Explained
Learn when CSS should come before JavaScript in HTML, how browsers block rendering, and what ordering means for page performance.
Style a Checkbox with CSS: Custom Checkbox Controls
Learn why native checkbox styles are limited and how to build accessible custom checkboxes with CSS appearance, labels, focus states, and states.
Style an HTML File Input Button with CSS
Learn how to style an HTML file input button using CSS ::file-selector-button and an accessible custom label fallback.
Styling SVG Paths Loaded with img in CSS
Learn why CSS cannot target paths inside an SVG loaded with img, and how to use inline SVG, currentColor, and other practical options.