February 2, 2024
Complex CSS Layout with Grid
Why Grid?
- For more Complex layouts.
- Grid has 2-dimensional alignment, using a top-down approach to layout.
- Where Flexbox focuses on space distribution within an axis, employing a bottom-up approach to layout.
- Grid and Flex can be used together along with others like float.
Grid VS Flex
CSS Flexible Box Layout Module Level
LINK- CSS Grid Layout Module
LINK - CSS Grid Layout Module Level 2
Grid VS Flex
1. Grid - Tracks - rows and columns
- Fixed sizing: 200px.
- Flexible sizing: 2fr - Frequency Regulation (Grid FR)
- Content-based sizing: Using the auto keyword or the min-content and max-
examples:
Grid set up the columns:
Space:
- Adapt the space specifications based on loyalty, ensuring flexibility in use
We can set up the Order of element
example: