Questions
CSS questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Make a div Fit Its Contents in CSS
Learn how to make a div only as wide as its content using CSS, including inline-block, fit-content, and common layout pitfalls.
How to Make the Body Fill the Full Browser Height in CSS
Learn how to make the body fill the browser height in CSS using html, body, min-height, and viewport units.
How to Offset HTML Anchors for a Fixed Header
Learn how to offset in-page HTML anchors when a fixed header covers content using CSS and JavaScript techniques.
How to Open a Bootstrap Dropdown on Hover Instead of Click
Learn how to make a Bootstrap dropdown open on hover instead of click, remove caret arrows, and understand the tradeoffs clearly.
How to Overlay One div Over Another in CSS
Learn how to overlay one div on another using CSS positioning, absolute positioning, and centering techniques.
How to Position a Div at the Bottom of Its Container in CSS
Learn how to place a div at the bottom of its container using CSS, including flexbox, grid, and positioning techniques.
How to Remove Input Focus Outline in CSS (Chrome) and Do It Accessibly
Learn how to remove or customize input focus outlines in CSS, especially in Chrome, while keeping forms accessible and usable.
How to Remove Space Between inline-block Elements in CSS
Learn why inline-block elements have gaps and how to remove space between them using practical CSS techniques and examples.
How to Remove an Inline Style Added with jQuery .css()
Learn how to remove inline styles added with jQuery .css(), including background-color, without affecting stylesheet defaults.
How to Remove the Blue Focus Border from a Button in Chrome with CSS
Learn why Chrome shows a blue focus border on buttons and how to style button focus states correctly with accessible CSS.
How to Resize Images While Keeping Aspect Ratio in CSS
Learn how to resize images in CSS without distortion by preserving aspect ratio using width, height, and max-width correctly.
How to Right-Align a Flex Item in CSS Flexbox
Learn the flexbox way to right-align an item using auto margins, justify-content, and flexible spacing in CSS layouts.
How to Select the First Element With a Class in CSS
Learn why `.red:first-child` fails in CSS and how to correctly target the first matching element using selectors like `:first-of-type`.
How to Set Table Cell Padding and Spacing in CSS
Learn how to replace HTML table cellpadding and cellspacing with CSS using padding and border-spacing correctly.
How to Stretch and Scale a CSS Background Image to Fit the Viewport
Learn how to scale a CSS background image to the browser viewport using background-size, cover, and contain with CSS only.
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.