2016-03-31 09:40:55 +08:00
|
|
|
---
|
|
|
|
order: 5
|
2016-08-08 10:40:02 +08:00
|
|
|
title:
|
2019-11-20 11:13:24 +08:00
|
|
|
zh-CN: 对齐
|
|
|
|
en-US: Alignment
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-06-09 22:19:35 +08:00
|
|
|
|
2016-08-08 10:40:02 +08:00
|
|
|
## zh-CN
|
|
|
|
|
2019-11-20 11:13:24 +08:00
|
|
|
子元素垂直对齐。
|
2015-06-09 22:19:35 +08:00
|
|
|
|
2016-08-08 10:40:02 +08:00
|
|
|
## en-US
|
|
|
|
|
2019-11-20 11:13:24 +08:00
|
|
|
Child elements vertically aligned.
|
2016-08-08 10:40:02 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-23 14:37:16 +08:00
|
|
|
import { Col, Divider, Row } from 'antd';
|
2022-05-19 09:46:26 +08:00
|
|
|
import React from 'react';
|
2015-10-27 23:52:17 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const DemoBox: React.FC<{ children: React.ReactNode; value: number }> = props => (
|
|
|
|
<p className={`height-${props.value}`}>{props.children}</p>
|
|
|
|
);
|
2015-10-27 23:52:17 +08:00
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
const App: React.FC = () => (
|
2020-02-26 21:00:43 +08:00
|
|
|
<>
|
2020-08-05 11:28:57 +08:00
|
|
|
<Divider orientation="left">Align Top</Divider>
|
2019-11-20 11:13:24 +08:00
|
|
|
<Row justify="center" align="top">
|
2019-05-07 14:57:32 +08:00
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={100}>col-4</DemoBox>
|
|
|
|
</Col>
|
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={50}>col-4</DemoBox>
|
|
|
|
</Col>
|
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={120}>col-4</DemoBox>
|
|
|
|
</Col>
|
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={80}>col-4</DemoBox>
|
|
|
|
</Col>
|
2015-10-27 23:52:17 +08:00
|
|
|
</Row>
|
2015-10-28 20:55:49 +08:00
|
|
|
|
2020-08-05 11:28:57 +08:00
|
|
|
<Divider orientation="left">Align Middle</Divider>
|
2019-11-20 11:13:24 +08:00
|
|
|
<Row justify="space-around" align="middle">
|
2019-05-07 14:57:32 +08:00
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={100}>col-4</DemoBox>
|
|
|
|
</Col>
|
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={50}>col-4</DemoBox>
|
|
|
|
</Col>
|
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={120}>col-4</DemoBox>
|
|
|
|
</Col>
|
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={80}>col-4</DemoBox>
|
|
|
|
</Col>
|
2015-10-27 23:52:17 +08:00
|
|
|
</Row>
|
2015-10-28 20:55:49 +08:00
|
|
|
|
2020-08-05 11:28:57 +08:00
|
|
|
<Divider orientation="left">Align Bottom</Divider>
|
2019-11-20 11:13:24 +08:00
|
|
|
<Row justify="space-between" align="bottom">
|
2019-05-07 14:57:32 +08:00
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={100}>col-4</DemoBox>
|
|
|
|
</Col>
|
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={50}>col-4</DemoBox>
|
|
|
|
</Col>
|
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={120}>col-4</DemoBox>
|
|
|
|
</Col>
|
|
|
|
<Col span={4}>
|
|
|
|
<DemoBox value={80}>col-4</DemoBox>
|
|
|
|
</Col>
|
2015-10-27 23:52:17 +08:00
|
|
|
</Row>
|
2022-04-03 23:27:45 +08:00
|
|
|
</>
|
2015-10-27 23:52:17 +08:00
|
|
|
);
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
export default App;
|
2019-05-07 14:57:32 +08:00
|
|
|
```
|
2019-11-20 11:13:24 +08:00
|
|
|
|
|
|
|
```css
|
|
|
|
#components-grid-demo-flex-align [class~='ant-row'] {
|
2019-12-23 14:49:45 +08:00
|
|
|
background: rgba(128, 128, 128, 0.08);
|
2019-11-20 11:13:24 +08:00
|
|
|
}
|
|
|
|
```
|