前端常用代码(个人总结)

主要方便与自己的工作,便于查找。在此分享一下,希望有所帮助。

1.PC端头部信息样本
    <head>
        <meta charset="utf-8" />
        <meta name="Keywords" content="" />
        <meta name="Description" content="" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
        <title> title </title>
        <link rel="stylesheet" href="style.css"/>

        <link rel="stylesheet" href="..."/>
    </head>

2.PC端 css内外屏
    外屏:.ww{width:100%;min-width:1190px;}
    内屏:.w{width:1190px;margin:0 auto;}

3.常用字体:

    微软雅黑 "Microsoft YaHei"

4.透明度的完成写法

    filter:alpha(opacity=50);-moz-opacity:0.5; opacity:0.5;
5.超出显示省略号
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis;

6.JS统一写在 $(document).ready(function(){ }); 里面

7.js选项卡切换 
    $(this).addClass('active').siblings('li').removeClass('active');

8.rgba()低版本
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#4Cffffff,endColorstr=#4Cffffff);

9.IEcss hack
    IE6:_
    IE6/7: *
    IE7/Firefox:!important
    IE7:*+
    IE6/7/8:\9
    IE8:\0
    safari : select{ [;line-height: 36px;] }
    条件hack
    IE7以下版本:<!--[if lt IE 7]><html class="no-js lt-ie9 lt-ie8 lt-ie7"><![endif]-->
    IE7:<!--[if IE 7]><html class="no-js lt-ie9 lt-ie8"><![endif]-->
    IE8:<!--[if IE 8]> <html class="no-js lt-ie9"><![endif]-->
    IE8以上:<!--[if gt IE 8]><!--><html class="no-js"><!--<![endif]-->兼容性

10.禁止ios把数字识别为手机号
    <meta name="format-detection" content="telephone=no" />

11.360浏览器使用兼容模式打开
    <meta name='renderer'content='webkit|ie-comp|ie-stand' />
    <meta http-equiv="X-UA-Compatible" content="IE=IE7,chrome=1">

12.超出3行显示省略号
    {overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;}

以后会慢慢补充完善。

posted @ 2017-02-24 17:58  强哥遛遛弯儿  阅读(811)  评论(0编辑  收藏  举报