无法让内部div滚动

发布于 2025-01-18 07:16:25 字数 751 浏览 2 评论 0原文

我遇到的问题是,使用下面的代码结构(使用 React),我无法使 ScrollView 滚动。

<Window>
    <Sidebar/>
    <Body>
        <ScrollView>
            <Container>
                // Inner Container Content goes here
            </Container>
        </ScrollView>
    </Body>
</Window>
  • Window 具有 overflow: none; 并将其大小设置为 100% 高度和宽度。
  • 侧边栏正文仅具有定义它们在不同状态下彼此相对大小的CSS属性。
  • ScrollView 具有 overflow-y:scroll 以及高度和宽度属性。
  • 最后,Container 仅具有大小和样式属性。

我的问题主要与使 ScrollViewoverflow-y:scroll; 属性实际发生有关,尽管它是 Window 的子级。

我原本希望 ScrollView 能够正常工作,但事实似乎并非如此。

The problem I am having is that with the code structure below (Using React), I am unable to make the ScrollView scroll.

<Window>
    <Sidebar/>
    <Body>
        <ScrollView>
            <Container>
                // Inner Container Content goes here
            </Container>
        </ScrollView>
    </Body>
</Window>
  • The Window has overflow: none; as well as setting its size to 100% height and width.
  • The Sidebar and Body just have CSS properties defining their relative sizes to each other in different states.
  • The ScrollView has overflow-y: scroll as well as height and width properties.
  • Finally, Container just has sizing and style properties.

My problem mainly has to do with getting ScrollView's overflow-y: scroll; property to actually happen despite being a child of Window.

I was expecting the ScrollView to work regardless but that doesn't seem to be the case.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文