AI summary by TwinMind
This awesome CSS feature is blocked by drama (Google and Apple can't agree)
Theo - t3․gg
48m 25s
CSS Masonry Layout Introduction
- CSS centering has been problematic; grid/flexbox don't solve all layout problems
- Masonry layout (scattered images, photo blogs) difficult to implement without libraries
- First public working draft of CSS Grid Level 3 (masonry layout) published
- Drama between browser vendors: Firefox (initial proposal), Apple/Safari (support), Google/Chrome (opposition)
Apple/WebKit Position - Grid Integration Approach
- Masonry should be part of CSS grid as Grid Level 3
- Proposal:
display: gridwithgrid-template-rows: masonry - Benefits of grid integration:
- Access to full CSS grid power: track sizing, spanning, explicit placement, subgrid
- Unified feature development - new grid features work for both modular and columnar grids
- Existing developer tools compatibility (grid inspector)
- Four demos at webkit.org/demos/grid3
- Examples shown:
- Photo gallery with
grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)) - Mega menu layouts with max-content sizing
- Newspaper layouts with mixed content sizes
- Asymmetrical grids with different column widths
- Photo gallery with
- Masonry allows content spanning multiple columns with
.wideclass - Performance: browser automatically animates transitions between spans
Grid vs Masonry Conceptual Debate
- Historical context: grids used for thousands of years in design
- 20th century modernists proposed two-dimensional grids (rows + columns)
- Columnar grids (masonry) vs modular grids (traditional CSS grid)
- Apple argues both are legitimate "grids"
- Masonry enables creative layouts without cropping/truncating content
- Avoids uniform rectangle requirements of traditional grids
Google/Chrome Opposition - Separate Display Type
- Chrome team proposes
display: masonryas separate layout method - Performance concerns with mixed intrinsic/fixed track sizing:
- Grid: all items placed before layout, browser knows track contents
- Masonry: items placed during layout, browser doesn't know track distribution
- Mixed tracks require pre-layout step - exponential complexity with subgrids
- Example: 10 subgrids = 60 positions to check
- Syntax inconsistency issues:
- Many grid properties don't apply to masonry (grid-template-areas, autoflow, placement properties)
- Different valid values for shared properties
- Developer confusion about which properties work in masonry mode
- Alternative syntax:
masonry-template-tracks,masonry-track,masonry-direction
Technical Implementation Differences
Apple Grid Integration:
display: gridgrid-template-rows: masonryorgrid-template-columns: masonry- Full grid syntax compatibility
- Direction changes require switching template properties
Google Separate Display:
display: masonrymasonry-template-tracks: repeat(auto-fill, minmax(...))masonry-direction: column/row/column-reverse/row-reverse- Simpler syntax for direction changes
- Additional track sizing options not available in grid (auto-fill with max-content)
Naming and Syntax Concerns
- "Masonry" may not be best name (metaphorical, harder for non-English speakers)
- Alternative names considered: waterfall, off, none (but "none" already taken)
- Grid shorthand complexity vs masonry shorthand simplicity
- Template areas syntax differs between column/row masonry in grid version
Performance and Accessibility
- Exponential complexity with mixed track sizing and subgrids
- Reading order/keyboard navigation issues with reordered content
- Proposed reading-flow property to address accessibility
- Browser animation performance varies between approaches
Current Status and Next Steps
- CSS Working Group published first public working draft combining both approaches
- Both syntactic forms represent essentially equal capabilities
- Performance optimizations outlined for mixed track sizing
- Rapid development expected building on existing grid foundations
- Community feedback requested to guide further development
- Both approaches support all demo use cases shown
