Split Navigation - CSS: Cascading Style Sheets 编辑
A navigation pattern where one or more elements are separated from the rest of the navigation items.
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
BCD tables only load in the browser
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
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论