bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Learn/CSS/Modern Layout
CSS•Modern Layout

CSS Grid Items - Order

Set the Visual Order of the Grid Items

The CSS order property can be used to define the visual order of the grid items.

The first grid item in the HTML source code does not have to appear as the first item in the grid container.

Example

Formatted code
.item1 {order: 3;} .item2 {order: 6;} .item3 {order: 1;} .item4 {order: 2;} .item5 {order: 4;} .item6 {order: 5;}

Live preview

Expected output

1 2 3 4 5 6

Accessibility note: The order property provides visual reordering, but it does not change the logical order of elements in the DOM. This will affect users navigating the site with assistive technologies like screen readers, as the content will be read in a different order than it is visually presented.

Previous

CSS Grid Items - Alignment

Next

CSS 12-Column Grid Layout

This chapter

Overview
24

Lessons

64m

Read time

1. CSS Flexbox2. CSS Grid Layout3. Responsive Web Design4. CSS Flex Container5. CSS Grid Container6. Responsive Web Design - The Viewport7. CSS Flexbox justify-content8. CSS Grid Tracks9. Responsive Web Design - Building a Grid View10. CSS Flexbox Align11. CSS Grid Gap12. Responsive Web Design - Media Queries13. CSS Flex Items14. CSS Grid Container - Align Grid Content15. Responsive Web Design - Images16. CSS Responsive Flexbox17. CSS Grid Items18. Responsive Web Design - Frameworks19. CSS Naming Grid Items20. Responsive Web Design - Templates21. CSS Grid Items - Alignment22. CSS Grid Items - Order23. CSS 12-Column Grid Layout24. CSS @supports Rule