ant-design/components/grid/demo/flex.md

82 lines
2.1 KiB
Markdown
Raw Normal View History

2016-03-31 09:40:55 +08:00
---
order: 4
title:
zh-CN: 排版
en-US: Typesetting
2016-03-31 09:40:55 +08:00
---
2015-06-09 22:19:35 +08:00
## zh-CN
布局基础。
2015-06-09 22:19:35 +08:00
子元素根据不同的值 `start`、`center`、`end`、`space-between`、`space-around` 和 `space-evenly`,分别定义其在父节点里面的排版方式。
2015-06-09 22:19:35 +08:00
## en-US
Child elements depending on the value of the `start`, `center`, `end`, `space-between`, `space-around` and `space-evenly`, which are defined in its parent node typesetting mode.
```tsx
2022-05-23 14:37:16 +08:00
import { Col, Divider, Row } from 'antd';
import React from 'react';
2015-10-27 23:52:17 +08:00
const App: React.FC = () => (
<>
2020-08-05 11:28:57 +08:00
<Divider orientation="left">sub-element align left</Divider>
<Row justify="start">
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
2015-10-27 23:52:17 +08:00
</Row>
2020-08-05 11:28:57 +08:00
<Divider orientation="left">sub-element align center</Divider>
<Row justify="center">
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
2015-10-27 23:52:17 +08:00
</Row>
2020-08-05 11:28:57 +08:00
<Divider orientation="left">sub-element align right</Divider>
<Row justify="end">
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
2015-10-27 23:52:17 +08:00
</Row>
2020-08-05 11:28:57 +08:00
<Divider orientation="left">sub-element monospaced arrangement</Divider>
<Row justify="space-between">
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
2015-10-27 23:52:17 +08:00
</Row>
2020-08-05 11:28:57 +08:00
<Divider orientation="left">sub-element align full</Divider>
<Row justify="space-around">
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
2015-10-27 23:52:17 +08:00
</Row>
<Divider orientation="left">sub-element align evenly</Divider>
<Row justify="space-evenly">
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
<Col span={4}>col-4</Col>
</Row>
</>
);
export default App;
2019-05-07 14:57:32 +08:00
```
```css
#components-grid-demo-flex [class~='ant-row'] {
2019-12-23 17:16:26 +08:00
background: rgba(128, 128, 128, 0.08);
}
```