把經(jīng)常用到的css屬性設(shè)置為class,需要的時(shí)候引入即可崇堵。
- 將元素設(shè)置為block并且水平居中
.center-block { display: block; margin-right: auto; margin-left: auto; }
- 讓文字不可換行逼庞,超越邊界的文字顯示為省略號(hào)
.text-nowrap { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
- 讓文字隱藏
.text-hide { font: 0/0 a; color: transparent; text-shadow: none; background-color: transparent; border: 0; }
- 清除浮動(dòng)鸭巴,并且禁止margin重疊
.clearfix:after, .clearfix:before { content: ""; display: table; } .clearfix:after { clear: both; }
- 淘寶的CSS reset
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td { margin:0; padding:0; }
body, button, input, select, textarea { font:12px/1.5tahoma, arial, \5b8b\4f53; }
h1, h2, h3, h4, h5, h6{ font-size:100%; }
address, cite, dfn, em, var { font-style:normal; }
code, kbd, pre, samp { font-family:couriernew, courier, monospace; }
small{ font-size:12px; }
ul, ol { list-style:none; }
a { text-decoration:none; }
a:hover { text-decoration:underline; }
sup { vertical-align:text-top; }
sub{ vertical-align:text-bottom; }
legend { color:#000; }
fieldset, img { border:0; }
button, input, select, textarea { font-size:100%; }
table { border-collapse:collapse; border-spacing:0; }