ant-design/docs/spec/layout/demo/top.md

109 lines
3.1 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 0
title: 顶部导航
---
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 />` 做演示用,无须复制。
2015-11-09 18:05:23 +08:00
````jsx
2015-11-09 19:40:35 +08:00
import { Menu, Breadcrumb } from 'antd';
2016-03-23 10:43:43 +08:00
import BrowserDemo from '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>
<div className="ant-layout-top">
2015-11-14 20:41:10 +08:00
<div className="ant-layout-header">
<div className="ant-layout-wrapper">
<div className="ant-layout-logo"></div>
<Menu theme="dark" mode="horizontal"
defaultSelectedKeys={['2']} style={{lineHeight: '64px'}}>
<Menu.Item key="1">导航一</Menu.Item>
<Menu.Item key="2">导航二</Menu.Item>
<Menu.Item key="3">导航三</Menu.Item>
</Menu>
</div>
</div>
<div className="ant-layout-subheader">
<div className="ant-layout-wrapper">
<Menu mode="horizontal"
defaultSelectedKeys={['1']} style={{marginLeft: 124}}>
<Menu.Item key="1">二级导航</Menu.Item>
<Menu.Item key="2">二级导航</Menu.Item>
<Menu.Item key="3">二级导航</Menu.Item>
</Menu>
</div>
</div>
<div className="ant-layout-wrapper">
2015-11-09 21:00:30 +08:00
<div className="ant-layout-breadcrumb">
<Breadcrumb>
<Breadcrumb.Item>首页</Breadcrumb.Item>
<Breadcrumb.Item>应用列表</Breadcrumb.Item>
<Breadcrumb.Item>某应用</Breadcrumb.Item>
</Breadcrumb>
</div>
<div className="ant-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>
2015-11-14 21:08:43 +08:00
<div className="ant-layout-footer">
Ant Design 版权所有 © 2015 由蚂蚁金服体验技术部支持
</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
2015-11-09 19:40:35 +08:00
.ant-layout-top {
2015-11-09 21:00:30 +08:00
height: 100%;
2015-11-09 19:40:35 +08:00
}
2015-11-14 20:41:10 +08:00
.ant-layout-top .ant-layout-wrapper {
padding: 0 50px;
}
2015-11-09 19:40:35 +08:00
.ant-layout-top .ant-layout-header {
2015-11-14 20:41:10 +08:00
background: #404040;
2015-11-09 19:40:35 +08:00
height: 64px;
}
2015-11-14 20:41:10 +08:00
.ant-layout-top .ant-layout-logo {
width: 120px;
height: 32px;
background: #333;
border-radius: 6px;
margin: 16px 28px 16px 0;
float: left;
}
2015-11-09 19:40:35 +08:00
.ant-layout-top .ant-layout-subheader {
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;
}
.ant-layout-top .ant-layout-breadcrumb {
2015-11-14 20:41:10 +08:00
margin: 7px 0 -17px 24px;
2015-11-09 19:40:35 +08:00
}
.ant-layout-top .ant-layout-container {
background: #fff;
2015-11-14 21:12:02 +08:00
margin: 24px 0 0;
2015-11-14 20:41:10 +08:00
position: relative;
padding-top: 24px;
overflow: hidden;
2015-11-09 18:17:37 +08:00
}
2015-11-14 21:08:43 +08:00
.ant-layout-top .ant-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
````