1.英文截断

 p{height: 24px;overflow: hidden;width: 100%;word-wrap:break-word;word-break:break-all;}

2.css reset

/*reset*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, pre, a, code, del, em, img, strong, sub, sup, b, u, i, dl, dt, dd, ol, ul, li, fieldset, form, label, table, tbody, tfoot, thead, tr, th, td{ margin:0; padding:0; border:0; outline:0; font-size: 100%; vertical-align: baseline; }
table { border-collapse:collapse; border-spacing:0px; }
ol, ul {list-style:none;}
th,td{vertical-align:middle;}

3.clearfix 清除浮动

.clearfix:after{content:'.';display:block;height:0;clear:both;overflow:hidden;}
.clearfix{*zoom:1;}

4.body default

body {margin:0px auto; font-family:"宋体",Arial,Helvetica,sans-serif; font-size:12px;background:#f0f1f1;}
html,html body{_background-image:url(about:blank);_background-attachment:fixed;}

5.a样式

a{ text-decoration:none; color:#333333; }
a:hover{color:#E53434 !important; text-decoration:underline;}
a:hover img{text-decoration:none;}

6.来个css整套的(www.meilele.com 版权所有)

/*reset*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, pre, a, code, del, em, img, strong, sub, sup, b, u, i, dl, dt, dd, ol, ul, li, fieldset, form, label, table, tbody, tfoot, thead, tr, th, td{ margin:0; padding:0; border:0; outline:0; font-size: 100%; vertical-align: baseline; }
table { border-collapse:collapse; border-spacing:0px; }
ol, ul {list-style:none;}
th,td{vertical-align:middle;}
/*common*/
.Left { float:left; }
.Right { float:right; }
.r{text-align:right!important;}
.c{text-align:center!important;}
.l{text-align:left!important;}
a{ text-decoration:none; color:#333333; }
.red, a.red { color:#e53434; }
.gray, a.gray { color:#787878; }
.orange, a.orange { color:#F60; }
.black, a.black { color:#333; }
.white,a.white{ color:#FFF;}
.scarlet,a.scarlet{ color:#E53434;}
a:hover{color:#E53434 !important; text-decoration:underline;}
a:hover img{text-decoration:none;}
.none{ display:none;}
.clearfix:after{content:'.';display:block;height:0;clear:both;overflow:hidden;}
.clearfix{*zoom:1;}
.clear{clear:both }
.center{text-align:center;}
.w{width:980px; margin-left:auto;margin-right:auto;}
.height5 { height:5px; line-height:1px; }
.height10 { height:10px; line-height:1px; }
.height15 { height:15px; }
.height20 { height:20px; }
.height25 { height:25px; }
.height30 { height:30px; }
.height40 { height:40px; }
.mt10{margin-top:10px;}
.mt15{margin-top:15px;}
.mb10{margin-bottom:10px;}
.mt20{margin-top:20px;}
.inline_block { display:inline-block; }
.bold { font-weight:bold; }
.f14 { font-size:14px; }
.f16 { font-size:16px; }
.fline { text-decoration:line-through }
.uline{ text-decoration:underline;}
.yen{font-family:Arial;}
.pointer { cursor:pointer; }
.MLL_lazy{ border:none; color:#FFF; background:url(../zxwimg20121022/ajax-loader.gif) center center no-repeat; overflow:hidden; border:1px solid #999; padding:0px; line-height:1px; font-size:1px;}
.indent{ text-indent:-9999px; overflow:hidden;}
.w970{width:970px; margin-left:auto;margin-right:auto;}
img{background:#eee;overflow:hidden;vertical-align:top;}
.yahei{font-family: 'Microsoft YaHei',微软雅黑}body {margin:0px auto; font-family:"宋体",Arial,Helvetica,sans-serif; font-size:12px;background:#f0f1f1;}
html,html body{_background-image:url(about:blank);_background-attachment:fixed;}

7.操作cookie

/*** 设置cookie* @param {string} name key* @param {string} value value* @param {string/number} Days 有效期,或者'session'* @param {string} domain 作用域。默认meilele.com*/setCookie : function (name, value, Days, domain ,path) {Days = Days || 360;path = path || '/';domain = domain?";domain="+domain:";domain=meilele.com";var expDay = new Date();expDay.setTime(expDay.getTime() + parseInt(Days) * 24 * 60 * 60 * 1000);document.cookie = name + "=" + encodeURIComponent(value) + (Days == "session" ? "" : ";expires=" + expDay.toGMTString()) + domain + ";path="+path;},/** 获取cookie* @param {string} name key* @return {string} cookie值*/getCookie : function (name) {var cookieValue;if (document.cookie && document.cookie != '') {var cookies = document.cookie.split(';');var cookieLength = cookies.length;for (var i = 0; i < cookieLength; i++) {var cookie = cookies[i].replace(/(^\s*)|(\s*$)/g, "");if (cookie.substring(0, name.length + 1) == (name + '=')) {cookieValue = decodeURIComponent(cookie.substring(name.length + 1));break;}}}return cookieValue;},

8,设置为首页,加入收藏

/** @设为首页*/setHome : function(){var url = window.location.href;try {obj.style.behavior = 'url(#default#homepage)';obj.setHomePage(url);}catch(e) {if (window.netscape) {try {netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}catch(e) {alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");}var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);prefs.setCharPref('browser.startup.homepage', url);}}},/** @加入收藏*/addFavorites : function(){var sURL=window.location.href;var sTitle=document.title;try{window.external.addFavorite(sURL,sTitle);}catch(e){try{window.sidebar.addPanel(sTitle,sURL,"");}catch(e){alert("加入收藏失败,请使用Ctrl+D进行添加");}}},

9.将json格式数据转为字符串

//将json格式数据转化为字符串jsonToString: function( json ) {var strTemp = [];if ( typeof json != "object" ) {return;}for ( var k in json ) {strTemp.push( '\"' + k + '\":' + '\"' + json[k] + '\"' );}return "{" + strTemp.join(",") + "}";},

10.设置透明度

 /** @设置透明度* @param: target {objext} 目标对象* @param: value {number} 透明度值*/setOpacity : function( target, value ){if( document.documentElement.filters ){target.style.filter = "alpha(opacity="+value+")";}else{target.style.opacity = value/100;}},

11.元素距离顶部偏移量

 offsetTop:function (obj) {var offsetParent = obj;if(!obj)return 0;var top = 0;while (offsetParent != null && offsetParent != document.body) {top += offsetParent.offsetTop;offsetParent = offsetParent.offsetParent;}return top;},

12.取消事件默认行为

if ( e && e.preventDefault ){ e.preventDefault();} else { window.event.returnValue = false;} 

13.阻止事件冒泡

    function stopPP(e){var evt = e|| window.event;//IE用cancelBubble=true来阻止而FF下需要用stopPropagation方法evt.stopPropagation ?evt.stopPropagation() : (evt.cancelBubble=true);}

14.clearfix

/*clearfix*/
.clearfix:before, .clearfix:after {display: table;line-height: 0;content: "";
}.clearfix:after {clear: both;
}.clearfix:after {content: ".";display: block;height: 0;clear: both;visibility: hidden;
}
.clearfix {*zoom:1;
}

15.img hover

/*img hover*/
img:hover {opacity: 0.85;
}
img {-ms-interpolation-mode: bicubic;/*ie7 专用,消除图片锯齿*/-webkit-transition: all 200ms ease-in;-moz-transition: all 200ms ease-in;-o-transition: all 200ms ease-in;transition: all 200ms ease-in;
}

16,jquery 同步控制

$.ajaxSetup({ async : false
});
$.ajaxSetup({ async : true });   

那些年,哥私藏的源代码相关推荐

  1. 磊哥私藏书单分享,160买400的书!

    程序员的节日(10.24)到了,当当的活动也搞起来了,作为有上进心的你,怎么可能停止学习和进步呢?所以磊哥在当当满 400 元减 200 元的基础上,有要了一个减 40 的劵,也就是只需要花 160 ...

  2. 「紧急推送」宅哥私藏的福利,24小时删!

    宅哥开号以来推送了很多安卓和iOS的软件和科技类资讯,给小伙伴们的生活的工作带来了很大便利,但是宅哥深知,一个人的能力和眼界是有限的,所以今天要给小伙伴们隆重推荐一个宅哥的好朋友汤汤. 汤汤是互联网数 ...

  3. mac 配置c语言环境,C语言学习笔记————–MAC下配置GTK+环境

    一.GTK+是什么 GTK+(GIMP Toolkit)是一套源码以LGPL许可协议分发.跨平台的图形工具包.最初是为GIMP写的,已成为一个功能强大.设计灵活的一个通用图形库,是GNU/Linux下 ...

  4. 听池建强谈程序员的真正价值

    在微信上加了很多 MacTalk 的读者之后,经常会收到一些奇奇怪怪的问题,关于职场.关于选择.关于朋友.关于 Mac.关于技术等等,不一而足.但是我能回答的却很少.问题不好没法回答,问题太复杂没法回 ...

  5. 主题:曝腾讯前十位NB人Q号码 马化腾不过是OICQ养父

    排名分先后: 1号人物:马化腾 网名:pony 所持号码QQ:10001腾讯公司总裁CEO 2号人物:张志东网名:Tony 所持号码QQ:10002 腾讯公司技术总监CTO 3号人物:曾李青网名:kn ...

  6. 《深入分析Linux内核源代码》读书、私藏笔记大放送

    秉承着"不懂操作系统原理的程序员不是合格的程序员"的至理名言,鄙人又是买陈莉君老师的"Linux教学视频",又是研读其力作<深入分析Linux内核源代码& ...

  7. 油管最火KMP算法讲解,阿三哥的源代码!

    阿三哥的YouTube频道 来自阿三哥Github上的源码 package com.interview.string;/*** Date 09/22/2014* @author tusroy* * D ...

  8. 【Linux命令】《鸟哥Linux基础》第二十一章 软件安装:源代码与Tarball

    第二十一章 软件安装:源代码与Tarball 了解:如何将开放源码的程序设计.加入函数库的原理.通过编译而成为可执行的二进制程序,最后该文件可被我们所使用的一连串过程. 这一章介绍最原始的软件管理方式 ...

  9. cocos2d-xna for win8源代码轻松移植cocos-xna for wp游戏

    无意间看到杨哥弄了一个cocos2d-xna for win8出来可惜没有放出源代码,我试着要了一下结果他没理我,各种画圈圈. 那我只好自己弄一个了,源代码放出大家供交流学习使用,像杨哥说的一样就是一 ...

最新文章

  1. ad16自动布线设置规则_Cadence的allegro下设置阻抗
  2. VNC怎么和宿主机共享粘贴板(整理)
  3. java path 注解_@PathVariable注解的使用和@Requestparam
  4. CMD 命令行查看端口被哪个程序占用,并根据PID值,找到相应的程序,关闭掉对应服务或进程!...
  5. 大咖来信 | 李国杰院士:AI创业光靠算法走不远,警惕命运魔咒
  6. Animator Controller 继承关系
  7. 数据结构入门(二)固定容量数组
  8. 《图解算法》学习笔记之递归
  9. 8uftp怎么使用,小编教你8uftp怎么使用
  10. 台式计算机上的硬磁盘,如何在台式计算机上安装机械硬盘驱动器?在台式计算机上安装机械硬盘驱动器的详细步骤...
  11. python3 接入IOS推送apn
  12. 【饥荒】关于随机地图生成的方式
  13. H5 集成微信自定义分享(兼容 ios android)
  14. Windows 7系统和Windows 10系统的镜像下载地址集(含专业版)
  15. 数据结构初学之循环队列补充
  16. MYSQL学习教程总结
  17. 服务器突然关机的操作系统日志,windows服务器关机日志
  18. Anki(快速记忆软件) v2.1.14
  19. python游戏开发超级玛丽,100%真实版
  20. 利用GNS3模拟三层交换机

热门文章

  1. android临时root权限获取失败,获取ROOT权限失败怎么办?
  2. asio boost 异步错误处理_boost asio 学习(五) 错误处理
  3. Android source code gerrit
  4. 解决iconfont下载的图标显示的是小方框
  5. JAVA毕设项目西安财经大学校园一卡通管理系统(java+VUE+Mybatis+Maven+Mysql)
  6. oracle中修改字段类型,字段值不为空
  7. UIColor 颜色集
  8. 用友服务器恢复不显示账套,恢复用友账套数据的方法
  9. ser2net安装使用说明
  10. discuz发帖流程_Discuz论坛发帖技巧分享