css - 响应式菜单隐藏在广告中

标签 css menu responsive-design

我的响应式菜单在 adsense 代码里面,这里是菜单的 css。我有一个响应式网站 www.idealbanker.in,但是当点击菜单时,它会进入 adsense 广告,请指导我解决它。

我的响应式菜单在 adsense 代码里面,这里是菜单的 css。我有一个响应式网站 www.idealbanker.in,但是当点击菜单时,它会进入 adsense 广告,请指导我解决它。我的响应式菜单在 adsense 代码中,这里是菜单的 css。我有一个响应式网站 www.idealbanker.in,但是当点击菜单时,它会进入 adsense 广告,请指导我解决它。 enter image description here

<style>
ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
}

li {
    float: left;
}

li a {
    display: inline-block;
    color: white;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
}

li a:hover {
    background-color: #111;
}
ul.topnav {
    list-style-type: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #333;
}

/* Float the list items side by side */
ul.topnav li {float: left;}

/* Style the links inside the list items */
ul.topnav li a {
    display: inline-block;
    color: #f2f2f2;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    transition: 0.3s;
    font-size: 17px;
}

/* Change background color of links on hover */
ul.topnav li a:hover {background-color: #555;}

/* Hide the list item that contains the link that should open and close the topnav on small screens */
ul.topnav li.icon {display: none;}
@media screen and (max-width:680px) {
  ul.topnav li:not(:first-child) {display: none;}
  ul.topnav li.icon {
    float: right;
    display: inline-block;
  }
}

/* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens */
@media screen and (max-width:680px) {
  ul.topnav.responsive {position: relative;}
  ul.topnav.responsive li.icon {
    position: absolute;
    right: 0;
    top: 0;
  }
  ul.topnav.responsive li {
    float: none;
    display: inline;
  }
  ul.topnav.responsive li a {
    display: block;
    text-align: left;
  }
}


</style>
<script type="text/javascript">
function myFunction() {
    var x = document.getElementById("myTopnav");
    if (x.className === "topnav") {
        x.className += " responsive";
    } else {
        x.className = "topnav";
    }
}
</script>
</script>

最佳答案

解决方案

ul.topnav.responsive {
    position:relative;
    z-index: 10;
}

添加z-index属性来指定堆叠顺序。

关于css - 响应式菜单隐藏在广告中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43101950/

相关文章:

html - 如何在悬停时从上到下动画对齐?

html - 使用 css flex 网格图像

html - 如何防止我的水平菜单破坏我的网站布局?

Android 菜单选项总是成为列表菜单而不是网格菜单

c++ - 参数和全局变量,菜单程序

jquery - 使 div 中的图像充当背景图像封面

php - 在页面的正中央制作下拉菜单

css - 2 个元素之间的边距,其中一个元素的值为 "position: fixed;"

javascript - 当值太小时,high-charts datalabel 位置需要改变

jquery - 使用 CSS/JQUERY/HTML 居中多个响应式 Div