我是CSS和HTML的新手,遇到了一个让我完全难过的问题 - 我应用到导航栏的过渡效果似乎没有生效。我找到了一个无济于事的答案,并准备好在这一点上打破一些东西。下面是导航栏的CSS。
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
text-align: center;
}
li {
display: inline-block;
font-family: 'Oswald Light', Verdana, Geneva, sans-serif;
font-size: 20px;
background-color: #333;
-webkit-transition: all 0.9s ease;
-moz-transition: all 0.9s ease;
-o-transition: all 0.9s ease;
-ms-transition: all 0.9s ease;
transition: all 0.9s ease;
}
li a {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #6699cc;
}
答案 0 :(得分:1)
您需要将转换规则添加到li a
- 这是改变颜色的元素,而不是li
!
答案 1 :(得分:0)
您应该将转换代码替换为li} {} 所以它会像这样:
li a {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
-webkit-transition: all 0.9s ease;
-moz-transition: all 0.9s ease;
-o-transition: all 0.9s ease;
-ms-transition: all 0.9s ease;
transition: all 0.9s ease;
}
答案 2 :(得分:0)
您的CSS编辑:
<h3>Actions</h3>
<ul>
<li><a href="#">Edit</a> <a class="help" href="#">(Help)</a></li>
<li><a href="#">Delete</a> <a class="help" href="#">(Help)</a></li>
<li><a href="#">Back</a></li>
</ul>