You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.4 KiB
72 lines
1.4 KiB
5 years ago
|
---
|
||
|
order: 3
|
||
|
title:
|
||
|
zh-CN: 对齐
|
||
|
en-US: Align
|
||
|
---
|
||
|
|
||
|
## zh-CN
|
||
|
|
||
|
设置对齐模式。
|
||
|
|
||
|
## en-US
|
||
|
|
||
|
Config item align.
|
||
|
|
||
|
```jsx
|
||
|
import { Space, Button } from 'antd';
|
||
|
|
||
|
ReactDOM.render(
|
||
|
<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>,
|
||
|
mountNode,
|
||
|
);
|
||
|
```
|
||
|
|
||
|
```css
|
||
|
.space-align-container {
|
||
|
display: flex;
|
||
|
align-item: flex-start;
|
||
|
flex-wrap: wrap;
|
||
|
}
|
||
|
.space-align-block {
|
||
|
margin: 8px 4px;
|
||
|
border: 1px solid #40a9ff;
|
||
|
padding: 4px;
|
||
|
flex: none;
|
||
|
}
|
||
|
.space-align-block .mock-block {
|
||
|
display: inline-block;
|
||
|
padding: 32px 8px 16px;
|
||
|
background: rgba(150, 150, 150, 0.2);
|
||
|
}
|
||
|
```
|