用滚动条添加div以在同一行上划分

发布于 2025-01-17 15:05:49 字数 3318 浏览 6 评论 0原文

注意:我知道这个问题可能没有意义,但我真的不能说对不起(让我知道一个更合适的问题)

详细信息:基本上我是用水平滚动栏覆盖的一部分的纳维尔,这就是我的方式到目前为止,完成了滚动条,但是如果我添加其他任何内容,那就打破了有关如何制作此工作或替代方案的任何提示?还将Bulma用于容器以及将来的更多内容。

html:

<div class="container is-max-widescreen">

        <div class="outer">
            <div style="padding-left: 10px; padding-right: 10px;">
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>

            </div>
        </div>


    </div>

CSS

 @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600&display=swap');

        /* Menu Scroll Bar */

        .outer::-webkit-scrollbar {
            height: 8px;
            padding-left: 20px;
            padding-right: 20px;
        }

        .outer::-webkit-scrollbar-track {
            border-radius: 10px;
        }

        .outer::-webkit-scrollbar-thumb {
            background: rgb(99, 99, 99);
            border-radius: 10px;
        }

        .outer::-webkit-scrollbar-thumb:hover {
            background: rgb(120, 120, 120);
        }

        .scrollitem {
            background-color: #222831;
            border-radius: 16px;
            text-align: center;
            display: inline-block;
            padding: 1px 13px 1px 13px;
            color: #848484;
            font-family: 'Poppins', sans-serif;
        }

        .scrollitem:hover {
            background-color: #393e46;
            color: #eeeeee;
        }

        .outer {
            background-color: #333;
            overflow-y: hidden;
            white-space: nowrap;
            padding-top: 10px;
            padding-bottom: 10px;

        }

这是我想要的外观的一个示例:

  • 红色是示例中可滚动的文本

当前示例: https://codepen.io/shiiiina/pen/pen/yzyqmxy

NOTE: I'm aware the question may not make sense but i cant really word it right sorry (let me know a more suitable question)

Details: Basically im making a navbar with a horizontal scrollbar covering only part of it, this is how i've done the scrollbar so far but it breaks if i add anything else, any tips on how i could make this work or alternatives? Also Using Bulma for the container and some more stuff in the future.

HTML:

<div class="container is-max-widescreen">

        <div class="outer">
            <div style="padding-left: 10px; padding-right: 10px;">
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>
                <a href="#" class="scrollitem">ITEM</a>

            </div>
        </div>


    </div>

CSS

 @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@600&display=swap');

        /* Menu Scroll Bar */

        .outer::-webkit-scrollbar {
            height: 8px;
            padding-left: 20px;
            padding-right: 20px;
        }

        .outer::-webkit-scrollbar-track {
            border-radius: 10px;
        }

        .outer::-webkit-scrollbar-thumb {
            background: rgb(99, 99, 99);
            border-radius: 10px;
        }

        .outer::-webkit-scrollbar-thumb:hover {
            background: rgb(120, 120, 120);
        }

        .scrollitem {
            background-color: #222831;
            border-radius: 16px;
            text-align: center;
            display: inline-block;
            padding: 1px 13px 1px 13px;
            color: #848484;
            font-family: 'Poppins', sans-serif;
        }

        .scrollitem:hover {
            background-color: #393e46;
            color: #eeeeee;
        }

        .outer {
            background-color: #333;
            overflow-y: hidden;
            white-space: nowrap;
            padding-top: 10px;
            padding-bottom: 10px;

        }

Here's an example of what i want it to look like:

  • Red is the scrollable text seen in example

enter image description here

Current Example: https://codepen.io/shiiiina/pen/YzYQMXy

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

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

发布评论

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