A navigation pattern where one or more elements are separated from the rest of the navigation items.
[[File:../../../../../../media.prod.mdn.mozit.cloud/attachments/2018/10/07/16227/b892ea516275d9c5418c77b07115f993/split-navigation.png|Items separated into two groups.]]
Requirements
A common navigation pattern is to have one element pushed away from the others. We can use Flexbox to achieve this, without needing to make the two sets of items into two separate flex containers.
Recipe
Choices made
This pattern combines auto margins with Flexbox to split the items.
An auto margin absorbs all available space in the direction it is applied. This is how centering a block with auto margins works — you have a margin on each side of the block trying to take up all of the space, thus pushing the block into the middle.
In this case the left auto margin takes up any available space and pushes the item over to the right. You could apply the class push
to any item in the list.
Browser compatibility
The various layout methods have different browser support. See the charts below for details on basic support for the properties used.
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Flexbox
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
flex
|
Chrome Full support 29 Full support 29 Full support 21 Prefixed' Implemented with the vendor prefix: -webkit- |
Edge Full support 12 Full support 12 Full support 12 Prefixed' Implemented with the vendor prefix: -webkit- |
Firefox Full support 20 Full support 20 Notes' Since Firefox 28, multi-line flexbox is supported.
Notes' Before Firefox 32, Firefox wasn't able to animate values starting or stopping at Disabled' From version 18 until version 28 (exclusive): this feature is behind the Prefixed' Implemented with the vendor prefix: -webkit- Full support 48 Prefixed' Implemented with the vendor prefix: -webkit-
Disabled' From version 48: this feature is behind the |
IE Full support 11 Full support 11 Notes' Internet Explorer 11 ignores uses of Prefixed' Implemented with the vendor prefix: -ms-
Notes' Internet Explorer 10 and 11 ignore uses of |
Opera
Full support 12.1 |
Safari Full support 9 Full support 9 Full support 6.1 Prefixed' Implemented with the vendor prefix: -webkit- |
WebView Android Full support 4.4 Full support 4.4 Full support ≤37 Prefixed' Implemented with the vendor prefix: -webkit- |
Chrome Android Full support 29 Full support 29 Full support 25 Prefixed' Implemented with the vendor prefix: -webkit- |
Firefox Android Full support 20 Full support 20 Notes' Since Firefox 28, multi-line flexbox is supported.
Notes' Before Firefox 32, Firefox wasn't able to animate values starting or stopping at Disabled' From version 18 until version 28 (exclusive): this feature is behind the Prefixed' Implemented with the vendor prefix: -webkit- Full support 48 Prefixed' Implemented with the vendor prefix: -webkit-
Disabled' From version 48: this feature is behind the |
Opera Android
Full support 12.1 |
Safari iOS Full support 9 Full support 9 Full support 7 Prefixed' Implemented with the vendor prefix: -webkit- |
Samsung Internet Android Full support 2.0 Full support 2.0 Full support 1.5 Prefixed' Implemented with the vendor prefix: -webkit- |
Legend
- Full support
- Full support
- See implementation notes.'
- See implementation notes.
- User must explicitly enable this feature.'
- User must explicitly enable this feature.
- Requires a vendor prefix or different name for use.'
- Requires a vendor prefix or different name for use.
See also
Split Navigation by Mozilla Contributors is licensed under CC-BY-SA 2.5.