Skip to content
Practice Arena ยท 100 CSS Problems

CSS Code Challenges

Master CSS from beginner syntax to advanced 3D transforms, container queries, and subgrid with interactive, hands-on coding problems.

Progress0 / 100 Solved (0%)
Topic:
#01

Text Color

Set the text color of the heading (.title) to red.

Easy
#02

Background Color

Set the background color of the .box element to #3b82f6 (blue).

Easy
#03

Font Size

Increase the font size of paragraphs (.content) to 20px.

Easy
#04

Font Weight Bold

Make the .emphasis text bold.

Easy
#05

Text Alignment

Center align the heading inside .banner.

Easy
#06

Padding All Sides

Apply 24px of internal padding to all four sides of .card.

Easy
#07

Margin Auto Centering

Horizontally center the fixed-width .container by setting horizontal margin to auto.

Easy
#08

Border Radius (Rounded Corners)

Round the corners of the .badge element with an 8px border-radius.

Easy
#09

Solid Border

Add a 2px solid border with color #000 to .outline-box.

Easy
#10

Box-Sizing: Border-Box

Ensure padding and border are included in total element width and height using box-sizing.

Easy
#11

Display: Flex

Turn .flex-row into a flex container using the display property.

Easy
#12

Flexbox Gap

Set a 16px gap between items in the .flex-list container.

Easy
#13

Flex Justify Content: Center

Horizontally center flex items along the main axis using justify-content.

Easy
#14

Flex Align Items: Center

Vertically center flex items along the cross axis using align-items.

Easy
#15

Flex Justify Space-Between

Distribute items evenly so the first is at the start and the last is at the end.

Easy
#16

Display: None (Hide Element)

Hide the element with class .hidden from the rendered page.

Easy
#17

Opacity

Make .semi-transparent 50% transparent using the opacity property.

Easy
#18

Line Height

Set a comfortable line-height of 1.6 on the article paragraph.

Easy
#19

Text Decoration: None

Remove the default underline from links styled with class .clean-link.

Easy
#20

Text Transform: Uppercase

Transform the text in .label to uppercase capital letters.

Easy
#21

Circle with Border-Radius

Turn a 60px by 60px .avatar into a perfect circle.

Easy
#22

Letter Spacing

Add 2px of letter-spacing to the .tracking-wide element.

Easy
#23

Cursor: Pointer

Make the mouse cursor turn into a pointer hand when hovering over .clickable.

Easy
#24

Hover Pseudo-Class

Change the background color of .btn to #2563eb when hovered (:hover).

Easy
#25

Position Relative

Set position to relative on .parent so child absolute elements can anchor to it.

Easy
#26

Position Absolute (Top Right Pin)

Position .pin absolutely at top: 0 and right: 0 inside its container.

Easy
#27

Overflow Hidden

Clip any content spilling outside of .clipped-container using overflow.

Easy
#28

Font Family Fallback Stack

Set font-family on .text to Inter with fallback to sans-serif.

Easy
#29

Display: Inline-Block

Allow width and height to take effect on the inline .tag element using display: inline-block.

Easy
#30

CSS Variable Definition

Declare a custom property named --brand-color with value #6366f1 on :root.

Easy
#31

CSS Variable Usage var()

Apply the custom variable var(--brand-color) as the background color of .hero.

Easy
#32

Basic Box Shadow

Add a subtle drop shadow to .card: 0px 4px 6px with color rgba(0,0,0,0.1).

Easy
#33

Descendant Selector

Style all p tags inside .card with color #475569.

Easy
#34

Direct Child Selector

Target only direct child li elements of .menu using the child combinator (>).

Easy
#35

ID Selector

Target the element with id #unique-header and set its color to #0f172a.

Easy
#36

Flex Wrap Rows

Allow flex items in .badge-container to wrap onto multiple lines when space runs out.

Medium
#37

Flex Grow Proportion

Make .grow-item expand to fill all remaining available space inside the flex container.

Medium
#38

CSS Grid 3-Column Layout

Create a 3-column equal grid using grid-template-columns with 1fr fraction units.

Medium
#39

Grid Gap (Rows and Columns)

Set a 20px gap between both rows and columns in .grid-box.

Medium
#40

Grid Column Span

Make the .featured card span across 2 columns in the grid.

Medium
#41

Responsive Grid Auto-Fit

Create an auto-fitting responsive grid where columns are at least 200px wide up to 1fr.

Medium
#42

Sticky Header

Make .site-header stick to the top of the viewport when scrolling using position: sticky and top: 0.

Medium
#43

Z-Index & Stacking Context

Ensure .modal appears on top of overlapping relative elements with a z-index of 50.

Medium
#44

Transition Duration & Timing

Add a 0.3s ease transition for all properties on .animated-card.

Medium
#45

2D Transform: Scale

Scale .btn by 1.05 when hovered (:hover).

Medium
#46

2D Transform: TranslateY

Lift .card upwards by 4px on hover using transform: translateY(-4px).

Medium
#47

Media Query for Mobile Breakpoint

Add a media query for screens with max-width: 640px to set .stack flex-direction to column.

Medium
#48

Clamp() for Fluid Typography

Use clamp(1rem, 2.5vw, 2rem) for fluid responsive font-size on .fluid-title.

Medium
#49

Pseudo-Element ::before

Add a bullet symbol (content: "โ€ข ") before items in .custom-list li using ::before.

Medium
#50

First-Child Selector

Remove top border on only the :first-child element of .list-item.

Medium
#51

Nth-Child Even Stripes

Give alternating even rows in tr:nth-child(even) a background of #f8fafc.

Medium
#52

Linear Gradient Background

Create a background linear-gradient from to right from #4f46e5 to #06b6d4 on .gradient-bg.

Medium
#53

Aspect Ratio 16 / 9

Enforce a widescreen 16/9 aspect ratio on the .video-frame element using aspect-ratio.

Medium
#54

Object Fit: Cover

Prevent image distortion inside fixed-size .cover-img using object-fit: cover.

Medium
#55

Text Truncate with Ellipsis

Truncate overflowing text on a single line in .truncate with an ellipsis (...).

Medium
#56

Pointer Events None

Allow clicks to pass through .overlay to underlying elements using pointer-events: none.

Medium
#57

User Select None

Prevent text selection when double-clicking on .unselectable button.

Medium
#58

Accent Color for Inputs

Set the custom accent-color of the checkbox .themed-check to #10b981.

Medium
#59

Backdrop Filter Blur

Create a frosted glass blur effect on .glass-panel using backdrop-filter: blur(10px).

Medium
#60

Scroll Behavior Smooth

Enable smooth page scrolling across anchor links on the html root element.

Medium
#61

Rotate 45deg

Rotate the diamond .diamond by 45 degrees using transform: rotate(45deg).

Medium
#62

CSS Calc Function

Calculate .sidebar-offset width as calc(100% - 250px).

Medium
#63

Media Query Prefers-Color-Scheme Dark

Write a media query for (prefers-color-scheme: dark) that sets body background to #0f172a.

Medium
#64

Multi-Column Layout

Split the .newspaper article into 3 columns using column-count: 3 and column-gap: 24px.

Medium
#65

Min-Height Viewport 100vh

Ensure .hero-landing takes at least the full height of the viewport with min-height: 100vh.

Medium
#66

Align Self in Flexbox

Override the container align-items and align .special-item to flex-end.

Medium
#67

Order Property in Flexbox

Reorder .first-element to appear visually last using order: 99.

Medium
#68

Text Shadow Effect

Add a glowing text shadow to .glowing-headline: 0 0 10px #38bdf8.

Medium
#69

Clip-Path Polygon (Triangle)

Clip the square .triangle element into a polygon triangle: 50% 0%, 0% 100%, 100% 100%.

Medium
#70

CSS Filter Invert

Invert the colors of .invert-target completely using filter: invert(1).

Medium
#71

Scroll Snap Mandatory

Enable horizontal mandatory scroll snapping on .carousel container.

Medium
#72

Scroll Snap Align Start

Align each .slide item to the start edge of the snapping container.

Medium
#73

Custom Checkbox :checked Selector

Change the color of label adjacent to checked input: input:checked + label to #16a34a.

Medium
#74

Logical Properties (Margin-Inline)

Set internationalization-friendly horizontal margins using margin-inline: auto on .i18n-box.

Medium
#75

CSS Specificity Override (!important)

Force the color of .override to #dc2626 using the !important flag.

Medium
#76

Keyframe Spin Animation

Define an @keyframes spin that rotates from 0deg to 360deg, and apply it to .loader for 1s linear infinite.

Hard
#77

Pulse Opacity Animation

Create a pulse animation that animates opacity between 1 and 0.4 on .pulsing-dot.

Hard
#78

3D Perspective & Preserve-3D

Enable 3D space on .card-3d-wrap with perspective: 1000px, and set transform-style: preserve-3d on .card-inner.

Hard
#79

3D Card Flip (RotateY)

Flip .card-inner horizontally when parent .card-flip is hovered: transform: rotateY(180deg).

Hard
#80

Modern Relational Pseudo-Class :has()

Select .card that contains an <img /> element using the modern parent selector .card:has(img) and add padding: 0.

Hard
#81

:is() Selector Matching

Compact h1, h2, and h3 inside article using article :is(h1, h2, h3) with color: #0284c7.

Hard
#82

:where() Zero Specificity Selector

Use :where(button, .btn) with zero specificity to set border: none.

Hard
#83

Container Query Definition (Size)

Define container-type: inline-size on .card-parent to register it as a container query context.

Hard
#84

@container Query Rule

Apply @container (min-width: 400px) so .card switches to display: flex.

Hard
#85

CSS Subgrid

Make the nested .subgrid-item inherit parent columns using grid-template-columns: subgrid.

Hard
#86

Cascade Layers (@layer)

Declare an author layer named components using @layer components { .btn { padding: 12px; } }.

Hard
#87

Native CSS Nesting

Nest the hover pseudo-class inside .nav-item using the native & nesting syntax (&:hover { color: #2563eb; }).

Hard
#88

Modern Color Space: OKLCH

Set background color using perceptual modern oklch color: oklch(0.65 0.25 150) on .oklch-box.

Hard
#89

Color-Mix() Modern Function

Mix 80% blue with 20% white using color-mix(in srgb, blue 80%, white) on .mixed-bg.

Hard
#90

Animation Fill Mode Forwards

Ensure .slide-in retains its final keyframe values after completion using animation-fill-mode: forwards.

Hard
#91

Cubic Bezier Timing Curve

Apply an energetic bouncy cubic-bezier(0.68, -0.55, 0.27, 1.55) to transition on .bounce-btn.

Hard
#92

Custom CSS Counter

Initialize a counter called section-counter on ol, and increment it with counter-increment on li.

Hard
#93

Conic Gradient Wheel

Create a circular color wheel on .color-wheel using conic-gradient(red, yellow, lime, aqua, blue, magenta, red).

Hard
#94

Mix Blend Mode Difference

Invert text automatically against light and dark backgrounds using mix-blend-mode: difference on .invert-text.

Hard
#95

CSS Mask Image (Linear Gradient)

Fade out bottom text using mask-image: linear-gradient(to bottom, black 50%, transparent 100%) on .fade-mask.

Hard
#96

CSS Motion Path (Offset-Path)

Constrain the moving element .orbit-dot along a path using offset-path: path("M 0 0 L 100 100").

Hard
#97

Prefers Reduced Motion Query

Respect user motion sensitivity by disabling transitions and animations inside @media (prefers-reduced-motion: reduce).

Hard
#98

CSS Scoping (@scope)

Scope styles to .card-component excluding .card-body using @scope (.card-component) to (.card-body).

Hard
#99

CSS Field-Sizing: Content (Auto-Growing Textarea)

Allow .auto-textarea to grow dynamically with user input text using modern field-sizing: content.

Hard
#100

Master CSS Architecture: 3D Flip Card Component

Combine flexbox centering, 3D perspective (1000px), transform-style: preserve-3d, and backface-visibility: hidden to build a complete interactive card component.

Hard