CSS转换不仅仅适用于safari

时间:2014-07-11 07:16:25

标签: html css3

Here是代码

我在标签悬停时创建了一个下拉列表, 滑动的过渡效果在除safari之外的所有浏览器中都能正常工作。

我正在检查safari 5.1.7

HTML

<nav class="tabs">
    <ul class="clearfix">
        <li><a href="">Tab 1</a>
            <ul>
                <li><a href="">SubMenu 1</a></li>
                <li><a href="">SubMenu 2</a></li>
                <li><a href="">SubMenu 3</a></li>
                <li><a href="">SubMenu 1</a></li>
                <li><a href="">SubMenu 2</a></li>
                <li><a href="">SubMenu 3</a></li>
            </ul>
        </li>
        <li><a href="">Tab 2</a>
      <ul>
                <li><a href="">SubMenu 1</a></li>
                <li><a href="">SubMenu 2</a></li>
                <li><a href="">SubMenu 3</a></li>
                <li><a href="">SubMenu 1</a></li>
                <li><a href="">SubMenu 2</a></li>
                <li><a href="">SubMenu 3</a></li>
            </ul>
      </li>
        <li><a href="">Tab 3</a>
      <ul>
               <li><a href="">SubMenu 1</a></li>
                <li><a href="">SubMenu 2</a></li>
                <li><a href="">SubMenu 3</a></li>

            </ul></li>
    </ul>
</nav>

CSS

* {
  margin: 0;
  padding: 0;
  font-size: 16px;
  font-family: arial;
}
a {
  text-decoration: none;
  padding: 10px;
  display: block;
  color: green
}
.clearfix:after {
  clear: both;
  content: " ";
  display: block
}
ul {
  list-style: none;
  width: 100%;
  background: red;
}
.tabs > ul > li {
  float: left;
  position: relative;
}
.tabs > ul > li > a {
  position: relative;
  background: red;
  color: #fff;
  z-index: 1;
  padding: 10px 80px;
}
.tabs ul ul {
  position: absolute;
  left: 0;
  top: -300px;
  width: 200px;
  text-align: center;
  -webkit-transition: top 0.6s ease-in-out;
  -moz-transition: top 0.6s ease-in-out;
  -ms-transition: top 0.6s ease-in-out;
  -o-transition: top 0.6s ease-in-out;
  transition: top 0.6s ease-in-out;
  background: yellow;

}
.tabs li:hover ul {
  top: 39px;
}

无法确定究竟是什么问题。

1 个答案:

答案 0 :(得分:1)

更新了code

只需更改

.tabs li:hover ul {
  top: 100%;
}

.tabs li:hover ul {
  top: 39px;
}