cools maths gamesSurprise me

CSS Diner

Write a CSS selector that grabs exactly the bouncing dishes and food on the table, level by level.

CSS Diner title screen
  • Partly works on mobile
Report a problem

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

CSS Diner is a puzzle game that teaches CSS selectors. Each level sets a table with plates, bento boxes, apples, oranges and pickles, along with an order such as “Select the small apples.” Your goal is to type the selector that targets just those items.

How CSS Diner Works

The items you need bounce on the table. Under it, the HTML Viewer shows the real markup, and a side panel explains the selector for that level with syntax and examples. Type in the CSS Editor and press Enter.

Your selector is tested against actual elements. If it picks exactly the bouncing items, they fly off and the next level loads. Any answer that selects the right set counts, even if it differs from the example.

Levels grow step by step. After basics come descendants, commas and *, then +, ~ and >. Later levels cover pseudo-classes like :first-child, :nth-of-type, :empty and :not(), and finally attribute matches such as ^=, $= and *=.

Your First Few Minutes

  1. Read the order at the top of the table.
  2. Look at the HTML Viewer to see the real tag names.
  3. Type a selector such as plate and press Enter.
  4. If items shake, hover over the table to match items to code.
  5. Read the side panel before each new level.

Controls for CSS Diner

Keyboard, mouse and touch controls for CSS Diner
To do thisKeyboardMouse
Type a selectorType in the CSS Editor boxnot used
Check your answerEnterClick the "enter" button
Jump to a levelType the level number, then EnterOpen the menu (top right) and click a level
See an item's HTMLnot usedHover over an item on the table or a line in the HTML Viewer
Previous or next levelnot usedClick the arrows beside the level title
Close the level menuEscnot used

What It Trains

CSS Diner is a direct coding lesson. You learn real selector syntax and see right away which elements a rule matches.

It also builds logic. You think about structure, such as which item is a child of which, and write a rule that includes the right items and nothing else.

Strategy Notes

  • Start from the markup. The HTML shows the classes and IDs you can use.
  • Use hover to connect. Pointing at an item highlights its code line, and the reverse works too.
  • Remember nth counts from 1. :nth-child(3) is the third child.
  • Know the space from the arrow. plate apple finds any apple inside a plate, while plate > apple needs a direct child.
  • Adapt the examples. The help panel shows the exact pattern for the level.

Good to Know

Your current level and solved levels are saved in your browser. It runs best on a computer, since the two-column layout needs a wide screen and the hover tips need a mouse. Luke Pacholski (flukeout) made the original under MPL-2.0.

CSS Diner questions and answers

Do I need to know CSS before playing CSS Diner?

No. Every level comes with a panel that names the selector, shows its syntax and gives examples. The first levels only ask for plain tag names, so you can start from zero and pick it up as you go.

How many levels are there?

There are 32. They move from element types, IDs and classes to combinators, pseudo-classes and attribute selectors. Clearing level 32 ends the game.

Is there a penalty for wrong answers?

No. A wrong or broken selector makes the editor or the chosen items shake, and the right targets keep bouncing so you can try again.

Can I skip around?

Yes. Type a level number and press Enter, or open the menu at the top right. Solved levels show a checkmark there, and Reset Progress clears them.

Games that use coding like CSS Diner

Different rules, same kind of thinking.

Try something from another shelf