mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
add fixed-header demo for Layout (#5119)
This commit is contained in:
parent
e8ff1f25c4
commit
00aa253a26
68
components/layout/demo/fixed.md
Normal file
68
components/layout/demo/fixed.md
Normal file
@ -0,0 +1,68 @@
|
||||
---
|
||||
order: 6
|
||||
iframe: true
|
||||
title:
|
||||
zh-CN: 固定头部
|
||||
en-US: Fixed Header
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
一般用于固定顶部导航,方便页面切换。
|
||||
|
||||
## en-US
|
||||
|
||||
Fixed Header is generally used to fix the top navigation to facilitate page switching.
|
||||
|
||||
````jsx
|
||||
import { Layout, Menu, Breadcrumb } from 'antd';
|
||||
const { Header, Content, Footer } = Layout;
|
||||
|
||||
ReactDOM.render(
|
||||
<Layout>
|
||||
<Header className="header">
|
||||
<div className="logo" />
|
||||
<Menu
|
||||
theme="dark"
|
||||
mode="horizontal"
|
||||
defaultSelectedKeys={['2']}
|
||||
style={{ lineHeight: '64px' }}
|
||||
>
|
||||
<Menu.Item key="1">nav 1</Menu.Item>
|
||||
<Menu.Item key="2">nav 2</Menu.Item>
|
||||
<Menu.Item key="3">nav 3</Menu.Item>
|
||||
</Menu>
|
||||
</Header>
|
||||
<Content className="content">
|
||||
<Breadcrumb style={{ margin: '12px 0' }}>
|
||||
<Breadcrumb.Item>Home</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>List</Breadcrumb.Item>
|
||||
<Breadcrumb.Item>App</Breadcrumb.Item>
|
||||
</Breadcrumb>
|
||||
<div style={{ background: '#fff', padding: 24, minHeight: 280 }}>Content</div>
|
||||
</Content>
|
||||
<Footer style={{ textAlign: 'center' }}>
|
||||
Ant Design ©2016 Created by Ant UED
|
||||
</Footer>
|
||||
</Layout>
|
||||
, mountNode);
|
||||
````
|
||||
|
||||
````css
|
||||
#components-layout-demo-fixed .logo {
|
||||
width: 120px;
|
||||
height: 31px;
|
||||
background: #333;
|
||||
border-radius: 6px;
|
||||
margin: 16px 24px 16px 0;
|
||||
float: left;
|
||||
}
|
||||
#components-layout-demo-fixed .header {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
}
|
||||
#components-layout-demo-fixed .content {
|
||||
padding: 0 50px;
|
||||
margin-top: 64px;
|
||||
}
|
||||
````
|
Loading…
Reference in New Issue
Block a user