mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 01:19:45 +08:00
7fd093bd0a
* docs: add general components TS demo * docs: add layout components TS demo * docs: add navigation components TS demo * docs: add data entry components TS demo * chore(deps): add types for qs * docs: add data display TS demo * docs: add feedback components TS demo * docs: add other components TS demo * chore(deps): add types * docs: unified demo code style * docs: fix lint error * docs: add demo TS type * docs: fix demo TS type * test: update snapshot * docs: fix TS demo * feat: update Rate character type * docs: fix lint error * feat: update Rate character type * feat: update Rate character type
74 lines
1.4 KiB
Markdown
74 lines
1.4 KiB
Markdown
---
|
|
order: 3
|
|
title:
|
|
zh-CN: 对齐
|
|
en-US: Align
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
设置对齐模式。
|
|
|
|
## en-US
|
|
|
|
Config item align.
|
|
|
|
```tsx
|
|
import React from 'react';
|
|
import { Space, Button } from 'antd';
|
|
|
|
const App: React.FC = () => (
|
|
<div className="space-align-container">
|
|
<div className="space-align-block">
|
|
<Space align="center">
|
|
center
|
|
<Button type="primary">Primary</Button>
|
|
<span className="mock-block">Block</span>
|
|
</Space>
|
|
</div>
|
|
<div className="space-align-block">
|
|
<Space align="start">
|
|
start
|
|
<Button type="primary">Primary</Button>
|
|
<span className="mock-block">Block</span>
|
|
</Space>
|
|
</div>
|
|
<div className="space-align-block">
|
|
<Space align="end">
|
|
end
|
|
<Button type="primary">Primary</Button>
|
|
<span className="mock-block">Block</span>
|
|
</Space>
|
|
</div>
|
|
<div className="space-align-block">
|
|
<Space align="baseline">
|
|
baseline
|
|
<Button type="primary">Primary</Button>
|
|
<span className="mock-block">Block</span>
|
|
</Space>
|
|
</div>
|
|
</div>
|
|
);
|
|
|
|
export default App;
|
|
```
|
|
|
|
```css
|
|
.space-align-container {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
align-items: flex-start;
|
|
}
|
|
.space-align-block {
|
|
flex: none;
|
|
margin: 8px 4px;
|
|
padding: 4px;
|
|
border: 1px solid #40a9ff;
|
|
}
|
|
.space-align-block .mock-block {
|
|
display: inline-block;
|
|
padding: 32px 8px 16px;
|
|
background: rgba(150, 150, 150, 0.2);
|
|
}
|
|
```
|