Skip to content

Instantly share code, notes, and snippets.

View liveme's full-sized avatar
🎯
Focusing

David liveme

🎯
Focusing
View GitHub Profile
@liveme
liveme / ieVersion.js
Last active December 22, 2015 10:49 — forked from padolsey/gist:527683
// ----------------------------------------------------------
// A short snippet for detecting versions of IE in JavaScript
// without resorting to user-agent sniffing
// ----------------------------------------------------------
// If you're not in IE (or IE version is less than 5) then:
// ie === undefined
// If you're in IE (>=5) then you can determine which version:
// ie === 7; // IE7
// Thus, to detect IE:
// if (ie) {}
@liveme
liveme / randomColor.js
Last active December 24, 2015 06:39
JavaScript随机获取十六进制 (hex)颜色
function getRandomColor(){
return "#"+(Math.random()*0.16777215).toString(16).substring(3,9);
}
@liveme
liveme / clearfix .css
Last active August 29, 2015 13:57
clearfix
/*
*@ Name: 闭合浮动
*@ Update: 2013-02-17
*@ Usage: 在需要闭合浮动的元素上(浮动元素的父容器)加 .clearfix
*/
.clearfix:after {
visibility: hidden;
display: block;
content: ".";
@liveme
liveme / mod-vc.css
Created March 21, 2014 06:08
未知高度容器垂直居中
/*
*@ Name: 未知高度容器垂直居中
*@ Update: 2013-10-20
*@ Doc&Demo: http://www.liveme.org/about-the-vertical-center.html
*/
.mod-vc {
text-align: center;
font-size: 0;
*word-spacing: -1px; /* IE6、IE7 */
@liveme
liveme / ellipsis.css
Created March 21, 2014 06:09
文字溢出显示省略号
/*
*@ Name: 文字溢出显示省略号
*@ Update: 2013-08-04
*@ Demo: http://www.liveme.org/table-fixed-and-text-auto-hidden.html
*/
.ellipsis {
white-space: nowrap;
word-wrap: normal;
overflow: hidden;
@liveme
liveme / nowrap.css
Created March 21, 2014 06:11
强制不换行
/*
*@ Name: 强制不换行
*@ Update: 2013-08-04
*/
.nowrap {
white-space: nowrap;
word-wrap: normal;
}
@liveme
liveme / break-word.css
Created March 21, 2014 06:13
连续字符换行
/*
*@ Name: 强制不换行
*@ Update: 2013-08-04
*/
.nowrap {
white-space: nowrap;
word-wrap: normal;
}
@liveme
liveme / eq-layout.css
Last active August 29, 2015 13:57
等高布局
/*
*@ Name: 等高布局
*@ Update: 2013-03-26
*@ Usage:
* <div class="main eq-wrap">
* <div class="content eq-bd">content</div>
* <div class="aside eq-bd">aside</div>
* </div>
*/
@liveme
liveme / onepx.css
Last active August 29, 2015 13:57
IE6下1px高度
/*
*@ Name: IE6下1px高度
*@ Update: 2013-03-26
*@ Usage: 在目标元素之间加一个空格的转义符 &nbsp; ,如:<div class="onepx">&nbsp;</div>
* 或者考虑使用 1px 的 border-top 去代替。
*/
.onepx {
height: 1px;
line-height:1px;
@liveme
liveme / img-hide.css
Last active August 29, 2015 13:57
图片替换之隐藏文字
/*
*@ Name: 图片替换之隐藏文字[版本2]
*@ Desc: 图片加载完之前会显示文字,有利于ARIA
*@ Update: 2013-05-23
*@ Doc: http://www.iyunlu.com/view/css-xhtml/62.html
*@ Example: <a href="#" class="logo ir-warp"><span classs="ir">home page</span></a>
* .logo {
* width: 100px;
* height: 40px;
* *background: url(../imgs/logo.jpg) no-repeat 0 0;