cools maths gamesSurprise me

CSS Grid Carrot Patch

Use real CSS grid properties to cover carrots with water and weeds with poison over 28 levels.

CSS Grid Carrot Patch title screen
  • Works on mobile
Report a problem

Turn your phone sideways for a bigger view of this game.

CSS Grid Carrot Patch is a coding puzzle that teaches CSS grid layout in a garden. The garden is a five-by-five grid with carrots and weeds in some squares. Your goal is to write CSS that places water over the carrots and poison over the weeds.

How CSS Grid Carrot Patch Works

Each level shows a lesson, a code box and the garden. The garden is a real grid container, so the patch moves as you type. When it covers exactly the right squares, the Next button lights up.

Early levels use grid-column-start and grid-column-end, negative line numbers and span. Then you combine them with grid-column, grid-row and grid-area, and some levels have two patches that overlap.

Later you use order to shuffle auto-placed items, and finally reshape the grid with grid-template-columns, grid-template-rows and grid-template. Units include percentages, pixels, ems, repeat() and fr.

Your First Few Minutes

  1. Read the short lesson above the code box.
  2. Find the carrot and count grid lines from the left edge.
  3. Type a value such as grid-column-start: 3; and watch the water move.
  4. Adjust until the water covers only the carrot.
  5. Press Next or Enter to move on.

Controls for CSS Grid Carrot Patch

Keyboard, mouse and touch controls for CSS Grid Carrot Patch
To do thisKeyboardMouseTouch screen
Type CSSType in the code boxnot usedTap the code box and use the on-screen keyboard
Submit a correct answerEnter on the last line, or Ctrl + EnterClick "Next" once it lights upTap "Next"
Pick a levelnot usedClick the level counter, then a level number, or use the side arrowsTap the level counter, then a level number
Read about a propertynot usedPoint at a highlighted property name in the instructionsnot used

What It Trains

This game teaches real coding. You write CSS grid properties that work the same way in a web page.

It also builds spatial thinking. You picture rows and columns as numbered lines and work out where an area starts and stops.

Strategy Notes

  • Think in lines. Columns 2 through 4 run from line 2 to line 5.
  • Reach for span. span 3 covers three cells from wherever you start.
  • Learn the grid-area order. It is row start, column start, row end, column end.
  • Let fr split what is left. Fixed sizes come first, then fr shares the rest.
  • Hover over property names. The lesson words list the values they accept.

Good to Know

Your level, typed answers and solved list are saved in the browser, and a Reset link clears them. On tablets the garden and editor stack, and you type with the on-screen keyboard. Thomas Park made the original, called Grid Garden.

CSS Grid Carrot Patch questions and answers

Is CSS Grid Carrot Patch good for complete beginners?

Yes. Most of each stylesheet is already written, and you only fill in a line or two. Every level opens with a short lesson, and the early ones focus on one property at a time, so you can learn CSS grid from the ground up.

What happens at the end?

After the 28th level a short win screen appears. You can still open the level menu and replay any level you like.

Does my answer have to match the hint?

No. The game checks that each carrot is covered by water and each weed by poison, with the right size and spot. Any working code passes.

Why does the patch land one square off?

Grid lines sit between cells, so a five-column garden has six lines. A patch covering columns 2 to 4 ends at line 5, and -1 means the last line.

Games that use coding like CSS Grid Carrot Patch

Different rules, same kind of thinking.

Try something from another shelf