2015-06-18 15:26:29 +08:00
|
|
|
# Flex对齐
|
2015-06-09 22:19:35 +08:00
|
|
|
|
|
|
|
- order: 5
|
|
|
|
|
2015-06-15 17:46:42 +08:00
|
|
|
Flex 子元素垂直对齐。
|
2015-06-09 22:19:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
2015-10-27 23:52:17 +08:00
|
|
|
````jsx
|
|
|
|
var Row = antd.Row;
|
|
|
|
var Col = antd.Col;
|
|
|
|
|
|
|
|
var DemoBox = React.createClass({
|
|
|
|
render() {
|
|
|
|
const { value } = this.props;
|
|
|
|
const className = `hight-${value}`;
|
|
|
|
return (
|
|
|
|
<p className={className}>{this.props.children}</p>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
ReactDOM.render(
|
|
|
|
<div>
|
|
|
|
<p>顶部对齐</p>
|
|
|
|
<Row justify="center" align="top">
|
|
|
|
<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>
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
<p>居中对齐</p>
|
|
|
|
<Row justify="space-around" align="middle">
|
|
|
|
<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>
|
|
|
|
</Row>
|
|
|
|
|
|
|
|
<p>底部对齐</p>
|
|
|
|
<Row justify="space-between" align="bottom">
|
|
|
|
<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>
|
|
|
|
</Row>
|
|
|
|
</div>,
|
|
|
|
document.getElementById('components-layout-demo-flex-align')
|
|
|
|
);
|
2015-06-09 22:19:35 +08:00
|
|
|
````
|
|
|
|
|
|
|
|
|
|
|
|
|