html - tailwindcss 警报悬停在固定导航上

标签 html css tailwind-css

我有一个使用 Rails 5、Ruby 2.4 构建的网络应用程序。我使用 Tailwindcss 作为我的设计框架。

我有一张主图(下图),我在其中使用类似警报的顺风作为横幅来为新的网上商店做商品广告。它正好位于我希望它成为英雄的位置,但是在页面滚动时它漂浮在我的固定导航上,而在移动 View 中,当导航菜单下拉时,它漂浮在它上方阻挡导航 View 。

我不太确定如何解决这个问题,所以它位于导航后面并且不会阻碍导航功能。

链接到站点以供查看 Loadlead website

我的英雄形象代码:

<div class="flex flex-wrap sm:block bg-transparent" id="header-hero">
  <div class="container mx-auto">

    /* BANNER THATS CAUSING ISSUES */
    <div class="bg-transparent text-center py-4 lg:px-4">
      <div class="p-2 bg-load-lead-green items-center text-white leading-none lg:rounded-full flex lg:inline-flex opacity-75 border-b-4 border-black md:mt-8">
        <span class="flex rounded-full bg-blue uppercase px-2 py-1 text-xs font-bold mr-3 border-b-2 border-black">New</span>
        <span class="font-semibold mr-2 text-left flex-auto">Pre-order LoadLead gear in our new web store</span>
        <svg class="fill-current opacity-75 h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M12.95 10.707l.707-.707L8 4.343 6.586 5.757 10.828 10l-4.242 4.243L8 15.657l4.95-4.95z"/></svg>
      </div>
    </div>
/* END BANNER */

    <div class="flex py-8 px-4 sm:px-8">
      <div class="w-full py-8">
        <p class="text-4xl text-black font-sans font-bold mb-1">Trucking. Simplified</p>
        <p class="text-xl text-black sm:text-lg mb-6 font-sans font-semibold">Minimize your trucks downtime &amp; keep your loads moving!</p>
        <a class="bg-blue text-white no-underline uppercase text-sm px-4 py-2 rounded-full font-bold hover:bg-blue border border-b-4 border-black hover:border-transparent cursor-not-allowed" href="/#">Take a Tour</a>
        <a class="bg-load-lead-green text-white no-underline uppercase text-sm px-4 py-2 rounded-full font-bold hover:bg-load-lead-green border border-b-4 border-black hover:border-transparent cursor-not-allowed" href="/#">Join the Community</a>
      </div>
    </div>
  </div>
</div>

如有任何帮助,我们将不胜感激!

最佳答案

您需要将英雄作为相对位置,将横幅作为绝对位置。

关于html - tailwindcss 警报悬停在固定导航上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49970502/

相关文章:

html - 使用 CSS 的文本倾斜边距

javascript - 你能修改 NextJS 的挂载元素或向 __next div 添加类吗?

javascript - 在范围值中输出 HTML 输入范围

javascript - JQuery 和 HTML : How to use echo $_POST to get data from one form to another

html - CSS 网格布局中列的反向顺序

html - 在单行中列出元素的绝对位置

html - Bootstrap 3 网格 : Responsive Position Absolute Bottom Width Issue

html - 无法将按钮与输入对齐

tailwind-css - 顺风自定义表格 : how to add your own color (hex value)

javascript - 在 React 组件之间使用 mui 图标