[英]How to use antd divider to separate two sides of the screen in a react component?
I am using antd and would like the vertical divider to split the two sides of my screen.我正在使用 antd 并希望垂直分隔线将屏幕的两侧分开。 The two sides are in fact separated by different
Col
components.两侧实际上是由不同的
Col
组件隔开的。 They currently look something like this:它们目前看起来像这样:
class Example extends React.Component {
render () {
return (
<Row>
<Col span={11}>
CONTENT ONE SIDE
</Col>
<Col span={2}>
<Divider type='vertical'/>
</Col>
<Col span={11}>
CONTENT OTHER SIDE
</Col>
</Row>
)
}
}
The issue here is that the Divider is barely appearing.这里的问题是 Divider 几乎没有出现。 I would like it to go all the way down where the content ends.
我希望它一直到内容结束的地方。 Instead, it is just a tiny little line.
相反,它只是一条很小的小线。
This is a screenshot of what it currently looks like:这是它当前外观的屏幕截图:
You can barely see the divider in the middle.你几乎看不到中间的分隔线。
How can I make the vertical divider be as long as the content?如何使垂直分隔线与内容一样长?
Thanks!谢谢!
您可以将分隔线的height
设置为100%
,请参阅此沙箱
<Divider type="vertical" style={{ height: "100%" }} />
Mine doesn't work with the above answers.我的不适用于上述答案。 After a little bit of work.
经过一点工作。 I finally got this below code to work.
我终于让下面的代码起作用了。
< Divider
type="vertical" style={{ height: "100px", backgroundColor: "#000" }}
/>
height 100%高度 100%
<Row>
<Col span={11}>
CONTENT ONE SIDE
<br />
CONTENT ONE SIDE
<br />
CONTENT ONE SIDE
<br />
</Col>
<Col span={2}>
<Divider type="vertical" style={{ height: "100%" }} />
</Col>
<Col span={11}>CONTENT OTHER SIDE</Col>
</Row>
https://codesandbox.io/s/antd-create-react-app-forked-rzp10?file=/index.js:181-499 https://codesandbox.io/s/antd-create-react-app-forked-rzp10?file=/index.js:181-499
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.