mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-04 17:09:46 +08:00
dda45e4796
* feat: support narrow theme mode * chore: rename narrow to compact * chore: height part * chore: preview compact mode * chore: to make site corrected * chore: preview site * docs: 📖 document compact theme usage * docs: tweak theme doc * docs: 📖 Add description about double css bundle size * chore: preview * chore: for preview * chore: adjust pagination * chore: compact mode done! * chore: remove useless todo * chore: fix review bug * chore: fix review bug * chore: fix card margin * chore: fix review bug * chore: fix review bug * chore: improve i18n and transition * Update site/theme/static/common.less Co-Authored-By: 偏右 <afc163@gmail.com> * chore: fix button size and description padding * chore: update snapshots * chore: add compact css bundlesize limit * chore: compact dist support Co-authored-by: afc163 <afc163@gmail.com>
66 lines
1.6 KiB
Markdown
66 lines
1.6 KiB
Markdown
---
|
|
order: 6
|
|
iframe: 360
|
|
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 style={{ position: 'fixed', zIndex: 1, width: '100%' }}>
|
|
<div className="logo" />
|
|
<Menu theme="dark" mode="horizontal" defaultSelectedKeys={['2']}>
|
|
<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="site-layout" style={{ padding: '0 50px', marginTop: 64 }}>
|
|
<Breadcrumb style={{ margin: '16px 0' }}>
|
|
<Breadcrumb.Item>Home</Breadcrumb.Item>
|
|
<Breadcrumb.Item>List</Breadcrumb.Item>
|
|
<Breadcrumb.Item>App</Breadcrumb.Item>
|
|
</Breadcrumb>
|
|
<div className="site-layout-background" style={{ padding: 24, minHeight: 380 }}>
|
|
Content
|
|
</div>
|
|
</Content>
|
|
<Footer style={{ textAlign: 'center' }}>Ant Design ©2018 Created by Ant UED</Footer>
|
|
</Layout>,
|
|
mountNode,
|
|
);
|
|
```
|
|
|
|
```css
|
|
#components-layout-demo-fixed .logo {
|
|
width: 120px;
|
|
height: 31px;
|
|
background: rgba(255, 255, 255, 0.2);
|
|
margin: 16px 24px 16px 0;
|
|
float: left;
|
|
}
|
|
.site-layout .site-layout-background {
|
|
background: #fff;
|
|
}
|
|
```
|
|
|
|
<style>
|
|
[data-theme="dark"] .site-layout .site-layout-background {
|
|
background: #141414;
|
|
}
|
|
</style>
|