溢出滚动x和可见的y

发布于 2025-02-12 22:38:33 字数 535 浏览 0 评论 0原文

我的问题与此设置有关: https://play.tai​​lwindcss.com/477uvfmgtao

标记名元素,工具提示出现……但是,该行可在x方向上滚动。这是强制性的。 但是,当我设置此溢出行为时,该工具提示在悬停和滚动中看不到……。

我想让工具提示朝y方向溢出,而我可以沿x方向滚动,这是怎么可能的?

正如我所看到的,与答案有关,我的问题并没有导致我的想法。

⭐️我想要的是这种行为:

”在此处输入图像描述”

My question is related to this setup: https://play.tailwindcss.com/47UVFMGtao

When you hover a TagName element, a tooltip appears … however, the row is scrollable in x direction. This is mandatory.
However, when I set this overflow behavior, the tooltip is not visible on hover and also to scroll….

I want to let the tooltip overflow the row in y direction while I can scroll in x direction , how is this possible?

As I see related to the answers, my question is not leading to my idea.

⭐️ What I want is this behaviour:

enter image description here

???? Not this:

enter image description here
enter image description here

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

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

发布评论

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

评论(2

蓝颜夕 2025-02-19 22:38:33

您需要为Div包装器提供固定宽度,如下所示:

.flex.w-full.flex-row.items-center.gap-x-5.overflow-x-scroll.bg-indigo-100.p-5 {
    height: 150px;
}

这将使工具提示完全可见,并且在Y轴上也不会添加滚筒。

you need to give a fixed width to the div wrapper like below:

.flex.w-full.flex-row.items-center.gap-x-5.overflow-x-scroll.bg-indigo-100.p-5 {
    height: 150px;
}

This will allow the tooltip to be fully visible and also there will be no scrollers added to the y-axis.

后知后觉 2025-02-19 22:38:33

首先,您可以通过在index.css文件中添加此实用程序来隐藏滚动条。

@layer utilities {
    /* Chrome, Safari and Opera */
    .no-scrollbar::-webkit-scrollbar {
      display: none;
    }

    .no-scrollbar {
      -ms-overflow-style: none; /* IE and Edge */
      scrollbar-width: none; /* Firefox */
    }
}

然后,您只需在Main Div中添加类No-Scrollbar即可。

其次,现在只是垂直滚动以使您的工具提示可见。

<script src="https://cdn.tailwindcss.com"></script>

<div class="flex w-full flex-row items-center gap-x-5 overflow-x-scroll no-scrollbar bg-indigo-100 p-5">
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100 z-20">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
</div>

First of all you can hide the scrollbar by adding this utility in index.css file.

@layer utilities {
    /* Chrome, Safari and Opera */
    .no-scrollbar::-webkit-scrollbar {
      display: none;
    }

    .no-scrollbar {
      -ms-overflow-style: none; /* IE and Edge */
      scrollbar-width: none; /* Firefox */
    }
}

Then you just add the class no-scrollbar in main div.

Secondly now just scroll vertically to get your tooltip visible.

<script src="https://cdn.tailwindcss.com"></script>

<div class="flex w-full flex-row items-center gap-x-5 overflow-x-scroll no-scrollbar bg-indigo-100 p-5">
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100 z-20">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
  <div class="group relative rounded bg-white p-2">
    <span>#TagName</span>
    <div class="absolute bottom-0 left-0 translate-y-full scale-0 whitespace-nowrap rounded bg-indigo-500 p-2 text-white group-hover:scale-100">info panel</div>
  </div>
</div>

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