2020-04-16 12:28:04 +08:00
|
|
|
---
|
|
|
|
order: 3
|
|
|
|
title:
|
|
|
|
zh-CN: 对齐
|
|
|
|
en-US: Align
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
设置对齐模式。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Config item align.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-21 22:14:15 +08:00
|
|
|
import { Button, Space } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import React from 'react';
|
2020-04-16 12:28:04 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2020-04-16 12:28:04 +08:00
|
|
|
<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>
|
2022-04-03 23:27:45 +08:00
|
|
|
</div>
|
2020-04-16 12:28:04 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2020-04-16 12:28:04 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
```css
|
|
|
|
.space-align-container {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
2021-04-06 10:17:45 +08:00
|
|
|
align-items: flex-start;
|
2020-04-16 12:28:04 +08:00
|
|
|
}
|
|
|
|
.space-align-block {
|
2021-01-30 19:39:02 +08:00
|
|
|
flex: none;
|
2020-04-16 12:28:04 +08:00
|
|
|
margin: 8px 4px;
|
|
|
|
padding: 4px;
|
2021-01-30 19:39:02 +08:00
|
|
|
border: 1px solid #40a9ff;
|
2020-04-16 12:28:04 +08:00
|
|
|
}
|
|
|
|
.space-align-block .mock-block {
|
|
|
|
display: inline-block;
|
|
|
|
padding: 32px 8px 16px;
|
|
|
|
background: rgba(150, 150, 150, 0.2);
|
|
|
|
}
|
|
|
|
```
|