css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv
CodePen probably won't work great in this browser. We generally only support the major desktop browsers like Chrome, Firefox, Safari, and Edge. Use this one at your own risk! If you're looking to test things, try looking at Pens/Projects in Debug View.
user profile image

An example of auto-placement using dense packing to create a grid of boxes.

The auto-placement rules place items in the following order:

  1. First place any none auto-placed items. Those that have a definite position on the grid. In this case that is the items that are white, and black.
  2. Next place any items locked to a given row (if placing by row) or column (if placing by column).
  3. Now place all other items.

If the packing mode is dense, steps 2 and 3 will work backwards to find empty spaces where the item fits.

Use Firefox Nightly/Developer Edition or Chrome Canary and you can drag the window to see the grid reflow

This Pen is a fork of rachelandrew's Pen Websafe colors meet CSS Grid (auto-placement demo).

Comments

  1. No comments yet.

Leave a Comment Markdown supported. Click @usernames to add to comment.

You must be logged in to comment.
Loading...
Loading...