Breadcrumb navigation helps the user to understand their location in the website by providing a breadcrumb trail back to the start page.
The items typically display inline with a separator to indicate a hierarchy between individual pages.
注意
: The example above uses two selectors to insert content before every
li
except the first one. This could also be achieved using one selector only:
.breadcrumb li:not(:first-child)::before {
content: "→";
}
This solution uses a more complex selector, but requires less rules. Feel free to choose the solution that you prefer.
This pattern is laid out using a simple flex layout demonstrating how a line of CSS can give us our navigation. The separators are added using CSS Generated Content. You could change these to any separator that you like.
I have used the
aria-label
and
aria-current
attributes to help users understand what this navigation is and where the current page is in the structure. See the related links for more information.
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.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
flex
|
Chrome 完整支持 29 | Edge 完整支持 12 |
Firefox
完整支持
20
注意事项
|
IE
完整支持
11
注意事项
|
Opera 完整支持 12.1 | Safari 完整支持 9 | WebView Android 完整支持 4.4 | Chrome Android 完整支持 29 |
Firefox Android
完整支持
20
注意事项
|
Opera Android 完整支持 12.1 | Safari iOS 完整支持 9 | Samsung Internet Android 完整支持 2.0 |
完整支持
见实现注意事项。
用户必须明确启用此特征。
要求使用供应商前缀或不同名称。