🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEcss

css Documentation

LOADING ENGINE...

CSS Order Property

Control the visual flow of layout items. Master the order property for Flexbox and Grid.

style.css
/* Move Item to End */
.item-1 {
order: 5;
}
/* Move Item to Start */
.item-2 {
order: -1;
}
2
3
1
style.css
1 / 8
🎼

Tutor:The CSS `order` property controls the visual order of items in a Flex or Grid container, without changing the HTML source.


Flexbox Mastery

Unlock nodes by learning layout manipulation.

Concept 1: Default Order

The order property determines the visual position of a flex item. The default value for all items is 0, meaning they appear in the order defined in the HTML source code.

System Check

What is the default order value for flex items?


Community Holo-Net

Share Layouts

Created a complex grid or flex layout using order? Share your code.

Enjoying this guide?

Codesyllabus is 100% free and open-source. Support our mission, pay for server infrastructure, and fuel new tutorials by buying us a coffee!

CSS Order Property

Author

Pascual Vila

CSS Architecture Instructor.

The order CSS property specifies the order of a flex or grid item in its container. Items are laid out in the source order by default, but the order property gives you the power to change this visual sequence.

How it Works

All flex/grid items have a default order value of 0.

  • Negative values: (e.g., -1) move the item to the beginning of the container.
  • Positive values: (e.g., 1, 2) move the item towards the end.
  • Same values: If two items have the same order value, they are sorted according to the HTML source order.

Accessibility Concerns

Warning: Visual Order vs. DOM Order

Changing the visual order using CSS does not change the DOM order. Screen readers, keyboard navigation (tabbing), and non-visual user agents will interact with the content based on the HTML source order, not the CSS order.

Best Practices

Use order primarily for visual layout adjustments, such as responsive design (e.g., moving a sidebar below content on mobile). Do not use it to reorder meaningful content like form fields or navigation links, as this breaks the logical tab flow for keyboard users.

CSS Order Glossary

order
CSS property that specifies the layout order of flex or grid items. Accepts integer values. Default is 0.
Flex Item
A direct child of a flex container. The order property applies to these items.
Source Order (DOM Order)
The order in which elements appear in the HTML code. This is the order used by assistive technologies.
Visual Order
The order in which elements are painted on the screen. This is what order manipulates.