CSS关于高度和滚动

发布于 2025-02-04 08:18:07 字数 587 浏览 3 评论 0 原文

试图一般学习CSS和逆风,并在高度上挣扎。

https://jsfiddle.net/7f6cd1bx/

我在上面制作了一个 https://tailwindcomponents.com/component/new-telegram-web-web-web-clone

要滚动到聊天列表的底部,最后一张卡只会部分显示。我希望它完全显示。

根据我可以解释的内容,聊天列表设置为 100VH ,因此它溢出并配置为隐藏。我不确定如何使其适合给定的高度。

我真正感到困惑的是,垂直滚动条是为了处理不适合的内容,但是现在垂直的卷轴本身无法适合给定的空间。

感谢任何帮助。谢谢你!

Trying to learn CSS and Tailwind in general and struggling with height.

https://jsfiddle.net/7f6cd1bx/

I made a code pen above based off this https://tailwindcomponents.com/component/new-telegram-web-clone

If I were to scroll to the bottom on the list of chats, the last card only shows up partially. I would like it to show completely.

Based on what I can interpret, the list of chats section is set to 100vh, as a result it overflows and was configured to hide it. I'm not sure how to get it to fit the given height.

What I'm really confused is, the vertical scrollbar is meant to deal with content that cannot fit, but now the vertical scrollbar itself cannot fit in the given space.

Appreciate any help. Thank you!

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

农村范ル 2025-02-11 08:18:07

显示:flex; 正确地被显示:block 适当地为此< div; div> 元素:


 <!-- left -->
        <div class="relative flex flex-col hidden h-full bg-white border-r border-gray-300 shadow-xl md:block transform transition-all duration-500 ease-in-out"
            style="width: 24rem">

尝试添加类左-side-wrap 到此&lt; div&gt;


 <!-- left -->
        <div class="left-side-wrap relative flex flex-col hidden h-full bg-white border-r border-gray-300 shadow-xl md:block transform transition-all duration-500 ease-in-out"
            style="width: 24rem">

之后添加此CSS代码以确保&lt; div&gt; 将具有 display:display: flex; 正确:


body .left-side-wrap{
  display: flex;  
}

在这里您可以检查更新的JS小提琴:
https://jsfiddle.net/j1rbv7un/

display: flex; properly has been overrided by display:block properly for this <div> element:


 <!-- left -->
        <div class="relative flex flex-col hidden h-full bg-white border-r border-gray-300 shadow-xl md:block transform transition-all duration-500 ease-in-out"
            style="width: 24rem">

try to add class left-side-wrap to this <div>


 <!-- left -->
        <div class="left-side-wrap relative flex flex-col hidden h-full bg-white border-r border-gray-300 shadow-xl md:block transform transition-all duration-500 ease-in-out"
            style="width: 24rem">

and after that add this CSS code to make sure that <div> will have display:flex; properly:


body .left-side-wrap{
  display: flex;  
}

Here you can check an updated Js fiddle:
https://jsfiddle.net/j1rbv7un/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文