sidihu

以前一直模模糊糊不知道怎么搞  今天测试了一下........

页面:

<div class="can2">
    <ul>
        <li><a href="index.html"><span>Home</span></a></li>
        <li><a href="about-us.html"><span>About Us</span></a></li>
        <li><a href="#"><span>Forum</span></a></li>
        <li><a href="projects.html"><span>Portfolio</span></a></li>
        <li><a href="contact-us.html"><span>Contact</span></a></li>
    </ul>
</div>

 

css文件:

.can2 ul
{
   width:950px;  height:25px; float:left; list-style-type:none;
}
 
.can2 li
{
    width:80px; display:inline; float:left; 
 }
 
.can2 a
{
    text-decoration:none;
 color:#6d7586;
 display:block;
 cursor:pointer;
 padding-left:5px;
}

.can2 span
{
    padding-right:5px;  
}
 
.can2 a:hover
{
 color:#000;
 text-decoration:none;
 background:url(../images/li-left-bg.gif) left no-repeat; 
}

.can2 a:hover span
{
 color:#000;
 text-decoration:none;
 background:url(../images/li-right-bg.gif) right no-repeat; 
}

.can2 a:active
{
 color:#000;
 text-decoration:none;
 background:url(../images/li-left-bg.gif) left no-repeat; 
}

.can2 a:active span
{
 color:#000;
 text-decoration:none;
  background:url(../images/li-right-bg.gif) right no-repeat; 
}

 

因为背景有两张  所以只能通过写.can2 a:hover 和.can2 a:hover span 来分别设置a span 的背景  如果一张的话就不用这么麻烦了.......

分类:

技术点:

相关文章:

  • 2021-09-05
  • 2021-05-04
  • 2021-11-02
  • 2021-10-08
  • 2022-02-07
猜你喜欢
  • 2021-11-13
  • 2022-01-28
  • 2021-11-19
  • 2021-08-15
  • 2021-09-25
相关资源
相似解决方案