li:hover的小知识

<style>

*{margin:0;padding:0;}

.user_banner_logo_wrap{ width:1920px;height:149px; overflow:hidden; background:url(http://img11.360buyimg.com/cms/jfs/t3415/2/2035385460/17797/2fdc18ba/583fdfc8N282cdb79.jpg)no-repeat;}

.user_banner_logo_wrap ul{list-style:none;}

.user_logo_main{width:990px;height:149px;margin:0auto;position:relative;}

 

.user_logo_bg{ width:990px;height:110px;position:absolute;top:0;left:0;}

.user_stylenone{width:113px;height:110px;position:absolute;top:0;left:0;}

 

.user_h_after{width:875px;height:110px;position:absolute;top:0;left:113px;}

.user_h_after li{

position:relative;

top:4px;

width: 106px;

height: 110px;

display: inline-block;

margin-right: -1px;

text-align:center;

line-height:100px;

overflow:hidden;

}

.user_h_afterli:hover{background:url(http://img30.360buyimg.com/cms/jfs/t3706/127/2072968915/1332/72e000a7/583ff366Nb0c5b405.jpg)no-repeat;

filter:alpha(opacity=90); 

     -moz-opacity:0.9; 

     -khtml-opacity: 0.9; 

     opacity: 0.9;  }

.user_getA{display:none;text-decoration:none;color:#fff;}

</style>

<divclass="user_banner_logo_wrap">

  <div class="user_logo_main">

   <div class="user_logo_bg">

   <imgsrc="http://img10.360buyimg.com/cms/jfs/t3538/60/2051727122/51408/623ccdf6/583fefdbN8a2bf565.jpg"width="990" height="110" alt="" />

   </div>

   <div class="user_stylenone">

   </div>

   <ul class="user_h_after">

   <li><a href="#" target="_blank"class="user_getA">品牌旗舰</a></li>

   <li><a href="#" target="_blank"class="user_getA">品牌旗舰</a></li>

   <li><a href="#" target="_blank"class="user_getA">品牌旗舰</a></li>

   <li><a href="#" target="_blank"class="user_getA">品牌旗舰</a></li>

   <li><a href="#" target="_blank"class="user_getA">品牌旗舰</a></li>

   <li><a href="#" target="_blank" class="user_getA">品牌旗舰</a></li>

   <li><a href="#" target="_blank"class="user_getA">品牌旗舰</a></li>

   <li><a href="#" target="_blank"class="user_getA">品牌旗舰</a></li>  

   </ul>

   </div>

</div>

<script>

$(document).ready(function() {

   $('.user_h_after li').hover(function(){

                  

                   $(this).find('a').show();

                  

                   },function(){

                            $(this).find('a').hide();

                           

                            });

});

</script>

相关资料:

说到xx:hover有人用的解决办法可能第一反应就是去网上找相关的JS来代替hover,其实有个超级简单的方法,就是在LI标记里加一个A标记,然后定义这个A标记为display:block即可,然后就可以把这个A标记宽高设置和LI一样,这样就很兼容IE6了,演示代码如下:
<ul>
<li><a href="#" style="display:block">栏目一</a></li>
<li><a href="#" style="display:block">栏目二</a></li>
<li><a href="#" style="display:block">栏目三</a></li>
</ul>
当然了,还有其他别的方法,连代码都不用写,只需引用一个文件就行:csshover.htc(下载地址:http://www.xs4all.nl/~peterned/htc/csshover3.htc ,如果失效,自行百度)
下载好后,只需在代码的<head></head>中间添加下面这段代码,然后就放心大胆的去使用hover吧(也支持focus):
<!--[if lte IE 6]>
       <style type="text/css">
       body { behavior:url("csshover.htc"); }
       </style>
<![endif]-->

总结就是三种方法:;

1、导插件

2、li设置高度同时保证撑开

3、li内部元素撑开li



以上为测试,如有错误,请各位指正

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值