css < a>标签在Safari中不可点击,但在其他浏览器中可以正常工作

waxmsbnn  于 2023-04-08  发布在  其他
关注(0)|答案(1)|浏览(168)

我有一个问题,我的头下拉不工作在Safari浏览器;它在Chrome浏览器中工作正常,但当我打开Safari时出现问题:我不能点击我的下拉菜单打开另一个下拉菜单。它是无法点击的,你有过这种问题吗?我使用<a>标签,也尝试了<span>,但没有改变。
下面是我的代码:

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

header {
  top: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  padding: 0px 7%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10000;
  .navbar ul {
    list-style: none;
  }
  .navbar ul li {
    position: relative;
    float: left;
  }
  .navbar ul li a,
  span {
    padding: 20px;
    color: #111d5e !important;
    font-weight: 600;
    text-decoration: none;
    display: block;
  }
  .navbar ul li a:after {
    background: none repeat scroll 0 0 transparent;
    bottom: 0;
    content: "";
    display: block;
    height: 2px;
    box-shadow: inset 3000px 0 0 0 #eed484;
    transition: width 0.3s ease 0s, left 0.3s ease 0s;
    width: 0;
  }
  .navbar ul li a:hover:after {
    width: 100%;
    left: 0;
  }
  .navbar ul li span:after {
    background: none repeat scroll 0 0 transparent;
    bottom: 0;
    content: "";
    display: block;
    height: 2px;
    box-shadow: inset 3000px 0 0 0 #eed484;
    transition: width 0.3s ease 0s, left 0.3s ease 0s;
    width: 0;
  }
  .navbar ul li span:hover:after {
    width: 100%;
    left: 0;
  }
  .navbar ul li ul li span,
  a {
    width: 100%;
  }
  .navbar ul li ul {
    position: absolute;
    left: 0;
    width: 250px;
    background: #ffffff;
    display: none;
    align-items: flex
  }
  .navbar ul li ul li {
    width: 100%;
  }
  // .navbar ul li:focus-within > ul,
  .navbar ul li:hover>ul {
    display: initial;
    z-index: 100;
  }
  #menu-bar {
    display: none;
  }
  label {
    font-size: 20px;
    color: #111d5e !important;
    cursor: pointer;
    display: none
  }
  .navbar ul li .language {
    width: 155px;
  }
}

@media (max-width: 991px) {
  header {
    padding: 15px;
  }
  header label {
    display: initial;
  }
  header .navbar {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #ffffff;
    display: none;
    z-index: 99999;
  }
  header .navbar ul li {
    width: 100%;
  }
  header .navbar ul li ul {
    position: relative;
    width: 100%;
  }
  header .navbar ul li ul li {
    background: #ffffff
  }
  header .navbar ul li ul li ul {
    width: 100%;
    left: 0;
  }
  #menu-bar:checked~.navbar {
    display: initial
  }
  header .navbar ul li .language {
    width: 100%;
  }
  header .navbar ul a {
    display: block;
    width: 100%;
    height: 100%;
  }
}
<header>

  <img routerLink="" style="cursor: pointer" src="assets/logo.png" alt="">

  <input type="checkbox" id="menu-bar">

  <label for="menu-bar">{{'header.fifth' | translate}}</label>

  <nav class="navbar">
    <ul>
      <li><a routerLink="">{{'header.first' | translate}}</a></li>
      <li style="cursor: pointer;"><a>{{'header.second' | translate}} </a>
        <ul style="cursor: pointer;">
          <li><a style="cursor: pointer;" routerLink="/customs">{{'body.head-1' | translate}}</a></li>
          <li><a style="cursor: pointer;" routerLink="/terrestrial">{{'body.head-2' | translate}}</a></li>
          <li><a style="cursor: pointer;" routerLink="/ship">{{'body.head-3' | translate}}</a></li>
          <li><a style="cursor: pointer;" routerLink="/train">{{ 'body.head-4' | translate}}</a></li>

        </ul>
      </li>
      <li style="cursor: pointer;"><a>{{'header.fourth' | translate}}</a>
        <ul class="language" style="float: left !important; cursor: pointer;">
          <li><a (click)="setLang('ka')" style="cursor: pointer" class="dropdown-item">{{'language.first' | translate}}</a></li>
          <li><a (click)="setLang('en')" style="cursor: pointer" class="dropdown-item">{{'language.second' | translate}}</a> </li>
          <li><a (click)="setLang('ru')" style="cursor: pointer" class="dropdown-item">{{'language.third' | translate}}</a> </li>

        </ul>
      </li>

    </ul>
  </nav>

</header>
2uluyalo

2uluyalo1#

有一个类似的问题渲染标签作为文本的一部分是不可点击的搜索问题我发现一些关于显示:内联不支持当我添加显示:内联块它修复了这个问题

相关问题