css不透明度过渡影响文本

时间:2013-12-08 12:24:46

标签: html css css3

我的导航栏上有一个问题..只用html和css来调试“龙互动”导航(仍然是新的,所以我不能handel javascript或jquery !!)。 因为在渐变背景上的过渡在css上是不可用的,所以我尝试了不透明度...事情看起来很适合背景但是当鼠标悬停时导航栏文本会消失!任何想法的人如何简单地克服这个问题!!(仅限css:p) HTML

<div class="wrapper">
<div class="container"><ul class="menu" rel="sam1">
<li class="active"><a href="#">Acceuil</a></li>
    <li><a href="service.html"><span>Services</span></a></li>
    <li><a href="#">assistance</a></li>
    <li><a href="http://www.ats.dz" target='_blank'>Produits</a></li>
    <li><a href="#">Contacts</a></li>
</ul>
</div></div>

CSS

.wrapper {
width: 100%;
height: 70px;
background : #464646;
background : -webkit-gradient(linear, left top, left bottom, from(rgb(168,168,168)), to(rgb(69,69,69)));
background : -moz-linear-gradient(top, rgb(168,168,168), rgb(69,69,69));
border-top: 0px solid #939393;
position: relative;
margin-bottom: 30px;
margin-left:150px;

}

ul {
margin: 0;
padding: 0;
}

 ul.menu {
height: 70px;
border-left: 1px solid rgba(0,0,0,0.3);
border-right: 1px solid rgba(255,255,255,0.3);
float:left;
}

 ul.menu li {
list-style: none;
float:left;
height: 69px;
text-align: center;
background: -webkit-gradient(radial, 50% 100%, 10, 50% 50%, 90, from(rgba(31,169,244,1)), to(rgba(0,28,78, 1)) );
background: -moz-radial-gradient(center 80px 45deg, circle cover, rgba(31,169,244,1) 0%, rgba(0,28,78, 1) 100%);

}

ul li a {
display: block;
padding: 0 20px;
border-left: 1px solid rgba(255,255,255,0.1);
border-right: 1px solid rgba(0,0,0,0.1);
text-align: center;
line-height: 69px;
background : -webkit-gradient(linear, left top, left bottom, from(rgb(168,168,168)), to(rgb(69,69,69)));
background : -moz-linear-gradient(top, rgb(168,168,168), rgb(69,69,69));
-webkit-transition-property: opacity;
-webkit-transition-duration: 1.5s;
-moz-transition-property: opacity;
-moz-transition-duration: 1.5s;
text-decoration:none;
color:#000;
font-weight:bold;
text-transform: uppercase;
font-size:13px;
opacity:1;
}

ul li a:hover {
opacity:0;

 }

 ul li.active a{
background: -webkit-gradient(radial, 50% 100%, 10, 50% 50%, 90, from(rgba(31,169,244,1)), to(rgba(0,28,78, 1)) );
background: -moz-radial-gradient(center 80px 45deg, circle cover, rgba(31,169,244,1) 0%, rgba(0,28,78, 1) 100%);
color:#fff;
 }

谢谢!

1 个答案:

答案 0 :(得分:0)

嗯,这是因为这一行:

ul li a:hover {
    opacity:0;
}