2016-03-31 09:40:55 +08:00
---
order: 0
2017-01-23 11:08:46 +08:00
title:
zh-CN: 顶部导航
en-US: Top
2016-03-31 09:40:55 +08:00
---
2017-01-23 11:08:46 +08:00
## zh-CN
2015-11-09 19:40:35 +08:00
2015-11-09 18:05:23 +08:00
一二级导航都在顶部。
2015-11-14 21:08:43 +08:00
顶部导航在页面布局上采用的是上下的结构, 一般主导航放置于页面的顶端, 从左自右依次为: logo、一级导航项、辅助菜单( 用户、设置、通知等) 。通常将内容放在固定尺寸( 例如: 1200px) 内, 整个页面排版稳定, 不受用户终端显示器影响; 上下级的结构符合用户上下浏览的习惯, 也是较为经典的网站导航模式。页面上下切分的方式提高了主工作区域的信息展示效率, 但在纵向空间上会有一些牺牲。此外, 由于导航栏水平空间的限制, 不适合那些一级导航项很多的信息结构。
2015-11-09 21:00:30 +08:00
> `<BrowserDemo />` 做演示用,无须复制。
2017-01-23 11:08:46 +08:00
## en-US
The first and second level nav are both at the top.
A top-bottom structure of page layouts is used to top navigation. Generally, the mainnav is placed at the top of the page, and put log, the first level navigation, secondary menu(users, settings, notifications) from left to right in it. We always put contents in a fixed size navigation.( eg: `1200px` ), the layout of the whole page is stable, it's not affected by viewing enviroment,; Top-bottom structure is conform to top-bottom viewing habit, it's a classical navigation pattern of websites. This pattern will bring demonstration efficiency up of the mian workarea, but it will also occupie some vertical spaces. And, because the horizontal space of the navigation is limited, this pattern is not suitable for the first level navigation which has too much information.
> `<BrowserDemo />` This is for demo, don't need to copy.
2017-01-19 15:19:03 +08:00
````__react
2015-11-09 19:40:35 +08:00
import { Menu, Breadcrumb } from 'antd';
2016-05-27 11:48:08 +08:00
import BrowserDemo from 'site/theme/template/BrowserDemo';
2015-11-09 19:40:35 +08:00
2015-11-09 18:05:23 +08:00
ReactDOM.render(
2015-11-09 21:00:30 +08:00
< BrowserDemo >
2016-12-23 17:58:37 +08:00
< div className = "layout-top" >
< div className = "layout-header" >
< div className = "layout-wrapper" >
< div className = "layout-logo" > < / div >
2015-11-14 20:41:10 +08:00
< Menu theme = "dark" mode = "horizontal"
defaultSelectedKeys={['2']} style={{lineHeight: '64px'}}>
2017-01-23 11:08:46 +08:00
< Menu.Item key = "1" > Navigation 1< / Menu.Item >
< Menu.Item key = "2" > Navigation 2< / Menu.Item >
< Menu.Item key = "3" > Navigation 3< / Menu.Item >
2015-11-14 20:41:10 +08:00
< / Menu >
< / div >
< / div >
2016-12-23 17:58:37 +08:00
< div className = "layout-subheader" >
< div className = "layout-wrapper" >
2015-11-14 20:41:10 +08:00
< Menu mode = "horizontal"
defaultSelectedKeys={['1']} style={{marginLeft: 124}}>
2017-01-23 11:08:46 +08:00
< Menu.Item key = "1" > The second level navigation< / Menu.Item >
< Menu.Item key = "2" > The second level navigation< / Menu.Item >
< Menu.Item key = "3" > The second level navigation< / Menu.Item >
2015-11-14 20:41:10 +08:00
< / Menu >
< / div >
< / div >
2016-12-23 17:58:37 +08:00
< div className = "layout-wrapper" >
< Breadcrumb >
2017-01-23 11:08:46 +08:00
< Breadcrumb.Item > Home< / Breadcrumb.Item >
< Breadcrumb.Item > App list< / Breadcrumb.Item >
< Breadcrumb.Item > Any app< / Breadcrumb.Item >
2016-12-23 17:58:37 +08:00
< / Breadcrumb >
< div className = "layout-container" >
2015-11-19 22:00:54 +08:00
< div style = {{ height: 210 } } > < / div >
2015-11-09 21:00:30 +08:00
< / div >
2015-11-09 19:40:35 +08:00
< / div >
2016-12-23 17:58:37 +08:00
< div className = "layout-footer" >
2017-01-23 11:08:46 +08:00
Ant Design all rights reserved © 2015 Created by Ant UED
2015-11-14 21:08:43 +08:00
< / div >
2015-11-09 19:40:35 +08:00
< / div >
2015-11-09 21:00:30 +08:00
< / BrowserDemo >
2016-01-08 18:10:58 +08:00
, mountNode);
2015-11-09 18:05:23 +08:00
````
````css
2016-12-23 17:58:37 +08:00
.layout-top {
2015-11-09 21:00:30 +08:00
height: 100%;
2015-11-09 19:40:35 +08:00
}
2016-12-23 17:58:37 +08:00
.layout-top .layout-wrapper {
2015-11-14 20:41:10 +08:00
padding: 0 50px;
}
2016-12-23 17:58:37 +08:00
.layout-top .layout-header {
2015-11-14 20:41:10 +08:00
background: #404040 ;
2015-11-09 19:40:35 +08:00
height: 64px;
}
2016-12-23 17:58:37 +08:00
.layout-top .layout-logo {
2015-11-14 20:41:10 +08:00
width: 120px;
height: 32px;
background: #333 ;
2016-12-23 17:58:37 +08:00
border-radius: 4px;
margin: 16px 24px 16px 0;
2015-11-14 20:41:10 +08:00
float: left;
}
2016-12-23 17:58:37 +08:00
.layout-top .layout-subheader {
2015-11-09 19:40:35 +08:00
height: 48px;
2015-11-14 21:08:43 +08:00
border-bottom: 1px solid #e9e9e9 ;
2015-11-09 19:40:35 +08:00
background: #fff ;
2016-12-23 17:58:37 +08:00
margin-bottom: 12px;
2015-11-09 19:40:35 +08:00
}
2016-12-23 17:58:37 +08:00
.layout-top .layout-container {
2015-11-09 19:40:35 +08:00
background: #fff ;
2016-12-23 17:58:37 +08:00
margin: 12px 0 0;
2015-11-14 20:41:10 +08:00
position: relative;
padding-top: 24px;
overflow: hidden;
2016-12-23 17:58:37 +08:00
border-radius: 4px;
2015-11-09 18:17:37 +08:00
}
2015-11-14 21:08:43 +08:00
2016-12-23 17:58:37 +08:00
.layout-top .layout-footer {
2016-01-14 11:08:57 +08:00
height: 64px;
2015-11-14 21:12:02 +08:00
line-height: 64px;
2015-11-14 21:08:43 +08:00
text-align: center;
font-size: 12px;
color: #999 ;
}
2015-11-09 18:17:37 +08:00
````