首页 > 技术文章 > 常用css

su1637 2018-01-15 10:51 原文

http://shang.qq.com/v3/index.html  扣扣推广

.w_1000 a:active{noOutline:expression(this.onFocus=this.blur())}
.w_1000 a:focus{outline:none;-moz-outline:none}
去掉浏览器默认边框

overflow:hidden;white-space:nowrap;text-overflow:ellipsis; -o-text-overflow:ellipsis;
文字限制,超出隐藏

opacity:0.8; filter:alpha(opacity=80);-moz-opacity:0.8;
背景透明

-moz-background-size:100% 100%;background-size:100% 100%;
背景图片缩放

font-family:"宋体",sans-serif;
字体样式


效果
if(objAllDiv[i].className == 'correlation')
        {
            objDiv = objAllDiv[i];    //将最后得到的class是correlation的div对象保存到目标对象上;
        }


下拉效果

 <script language="JavaScript" type="text/javascript"> 
    jQuery(function(){
    jQuery(".inner").hover(function(){
        jQuery(this).children("s").addClass("hover");
        jQuery(this).children(".fd").show();    
    },function(){
        jQuery(this).children("s").removeClass("hover");
        jQuery(this).children(".fd").hide();    
    })    
  })
</script>
 

获取当前时间

/**日期**/
        var oDate = new Date();
        var year = oDate.getFullYear();
        var month =add( oDate.getMonth()+1 );
        var day = add( oDate.getDate() );
        
        function add(n)
        {
            return     n>=10? n:'0'+n;
        }
        var oYear = document.getElementById('year'); //年
        var oMonth = document.getElementById('month');//月
        var oDay = document.getElementById('day');//日
        oYear.innerHTML = year;
        oMonth.innerHTML = month;
        oDay.innerHTML = day;
</script>

左侧导航

function showNav(id) {
    var parent = document.getElementById(id);
    parent.className = parent.className + "menu-hover";  //添加classname            
}
function hideNav(id) {
    var parent = document.getElementById(id);
    parent.className = "";  //添加classname    
}
<li----id="showNav1"----onmouseover="showNav('showNav1');" onmouseout="hideNav('showNav1')">


//顶部导航
function nav (id){
    document.getElementById(id).style.display ="block";
}
function nav2(id)
    {
    document.getElementById(id).style.display ="none"
    }

//二级导航
function setTab(m,n){
 var tli=document.getElementById("nav_li"+m).getElementsByTagName("li");
 var mli=document.getElementById("nav_con"+m).getElementsByTagName("ul");
 for(i=0;i<tli.length;i++){
  tli[i].className=i==n?"hover":"";
  mli[i].style.display=i==n?"block":"none";
 }
}

  $(window).scroll(function(){
        if($(this).scrollTop()>140){
           $(".head-top").addClass('fixed')
        }else{
           $(".head-top").removeClass('fixed')
       };    
   });
   
   

   $(".ss").click(function(){
        $('body,html').animate({scrollTop:600},500); 
        return false; 
    })
     $(".xx").click(function(){
        $('body,html').animate({scrollBottom:600},500); 
        return false; 
    })


Li偶数背景加背景

$(document).ready(function(e) {    

    //$(".dh_box_bg ul li:odd").css({ background: "#FFF6E4",border:"1px #FFF6E4 solid" });
    
});
    

 

推荐阅读