admin管理员组文章数量:1236709
I am using antd and would like the vertical divider to split the two sides of my screen. The two sides are in fact separated by different Col
ponents. 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. 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!
I am using antd and would like the vertical divider to split the two sides of my screen. The two sides are in fact separated by different Col
ponents. 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. 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!
Share Improve this question edited Jan 29, 2021 at 15:24 spencer741 1,1851 gold badge13 silver badges26 bronze badges asked Jul 23, 2019 at 17:22 theJulstheJuls 7,47018 gold badges96 silver badges182 bronze badges5 Answers
Reset to default 7You can set the height
of the divider to 100%
, see this sandbox
<Divider type="vertical" style={{ height: "100%" }} />
if height's 100 % doesn't work, add <Row>
. I predict you use only <Col />
.
I did it with height: auto.
<Divider type="vertical" style={{ height: "auto"}} />
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%
<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
版权声明:本文标题:javascript - How to use antd divider to separate two sides of the screen in a react component? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739930118a2211602.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论