文本兩端對(duì)齊:
復(fù)制代碼 代碼如下:
text-align:justify;
text-justify:inter-ideograph;
清除浮動(dòng):
復(fù)制代碼 代碼如下:
.clear{clear:both;line-height:0;height:0;font-size:0;}
清除浮動(dòng)偽類(lèi):
復(fù)制代碼 代碼如下:
.clearfix:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
設(shè)置不讓單詞斷開(kāi)
復(fù)制代碼 代碼如下:
word-break : keep-all
字符自動(dòng)換行
復(fù)制代碼 代碼如下:
word-break:keep-all;word-break:break-all;word-wrap:break-word
使用 line-height 垂直居中
復(fù)制代碼 代碼如下:
line-height:24px;/*使用固定寬度的容器并且需要一行垂直居中時(shí),使用 line-height 即可(高度與父層容器一致),更多的垂直居中總結(jié)可以看這里。
*/
清除容器浮動(dòng)
復(fù)制代碼 代碼如下:
#main {overflow:hidden;}
不讓鏈接折行
復(fù)制代碼 代碼如下:
a {white-space:nowrap;}
始終讓 Firefox 顯示滾動(dòng)條
復(fù)制代碼 代碼如下:
html {overflow:-moz-scrollbars-vertical;}
使塊元素水平居中
復(fù)制代碼 代碼如下:
body, html {min-height:101%;}或者margin:0 auto;
隱藏 Exploer textarea 的滾動(dòng)條
復(fù)制代碼 代碼如下:
textarea {overflow:auto;}
設(shè)置打印分頁(yè)
復(fù)制代碼 代碼如下:
h2 {page-break-before:always;}/*設(shè)置打印網(wǎng)頁(yè)時(shí)的分頁(yè)*/
刪除鏈接上的虛線框
復(fù)制代碼 代碼如下:
a,area { blr:expression(this.onFocus=this.blur()) }
:focus { -moz-outline-style: none; }
最簡(jiǎn)單的 CSS 重置
復(fù)制代碼 代碼如下:
* {margin: 0; padding: 0}/*此屬性慎用,雖然能消除默認(rèn)屬性,但是對(duì)瀏覽器渲染有影響,而且在語(yǔ)義化表達(dá)上也欠佳。*/
圖片回車(chē)后打文字需要屬性
復(fù)制代碼 代碼如下:
img{vertical-align:top;}
透明屬性
復(fù)制代碼 代碼如下:
filter:alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5;
cursor:hand;
鼠標(biāo)換成手的形狀
復(fù)制代碼 代碼如下:
cursor:hand;