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