【发布时间】:2021-02-27 11:12:01
【问题描述】:
我有以下布局:
https://codesandbox.io/s/fixed-header-antd483-forked-ub5tm?fontsize=14&hidenavigation=1&theme=dark
具有固定的标题和内容容器,高度为 100vh - 标题高度。在内容中,我有两列,我想让它们在大于其容器时可滚动。
如何在每列的固定高度内添加滚动条?
<Layout>
<Header style={{ position: "fixed", zIndex: 1, width: "100%" }}></Header>
<Content
style={{
marginTop: 64,
paddingTop: 8,
height: "calc(100vh - 64px)",
width: "100%"
}}
>
<Row>
<Col style={{ overflowY: "scroll" }} lg={6} md={9} sm={23} xs={23}>
<Card>hello World</Card>
<Card>hello World</Card>
<Card>hello World</Card>
<Card>hello World</Card>
<Card>hello World</Card>
<Card>hello World</Card>
<Card>hello World</Card>
</Col>
<Col lg={18} md={16}>
<Card
style={{
height: "calc(100vh - 64px)"
}}
>
//super long text content
...
</Card>
</Col>
</Row>
</Content>
</Layout>
【问题讨论】:
-
我猜你也需要链接 boostrap 吗?并且还重置了一些 CSS 规则(除非有我不知道的内置类)。可能的例子:codesandbox.io/s/fixed-header-antd483-forked-mi4wm?file=/…
标签: html css reactjs styles antd