頂級(jí)經(jīng)典常用的CSS屬性收集整理
更新時(shí)間:2008年09月05日 17:05:24 作者:
這里面整理的css都是些比較經(jīng)典的應(yīng)用,方便網(wǎng)頁(yè)愛(ài)好者制作出更好的效果
文本兩端對(duì)齊:
text-align:justify;
text-justify:inter-ideograph;
清除浮動(dòng):
.clear{clear:both;line-height:0;height:0;font-size:0;}
清除浮動(dòng)偽類:
.clearfix:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
設(shè)置不讓單詞斷開(kāi)
word-break : keep-all
字符自動(dòng)換行
word-break:keep-all;word-break:break-all;word-wrap:break-word
使用 line-height 垂直居中
line-height:24px;/*使用固定寬度的容器并且需要一行垂直居中時(shí),使用 line-height 即可(高度與父層容器一致),更多的垂直居中總結(jié)可以看這里。
*/
清除容器浮動(dòng)
#main {overflow:hidden;}
不讓鏈接折行
a {white-space:nowrap;}
始終讓 Firefox 顯示滾動(dòng)條
html {overflow:-moz-scrollbars-vertical;}
使塊元素水平居中
body, html {min-height:101%;}或者margin:0 auto;
隱藏 Exploer textarea 的滾動(dòng)條
textarea {overflow:auto;}
設(shè)置打印分頁(yè)
h2 {page-break-before:always;}/*設(shè)置打印網(wǎng)頁(yè)時(shí)的分頁(yè)*/
刪除鏈接上的虛線框
a,area { blr:expression(this.onFocus=this.blur()) }
:focus { -moz-outline-style: none; }
最簡(jiǎn)單的 CSS 重置
* {margin: 0; padding: 0}/*此屬性慎用,雖然能消除默認(rèn)屬性,但是對(duì)瀏覽器渲染有影響,而且在語(yǔ)義化表達(dá)上也欠佳。*/
圖片回車后打文字需要屬性
img{vertical-align:top;}
透明屬性
filter:alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5;
cursor:hand;
鼠標(biāo)換成手的形狀
cursor:hand;
復(fù)制代碼 代碼如下:
text-align:justify;
text-justify:inter-ideograph;
清除浮動(dòng):
復(fù)制代碼 代碼如下:
.clear{clear:both;line-height:0;height:0;font-size:0;}
清除浮動(dòng)偽類:
復(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á)上也欠佳。*/
圖片回車后打文字需要屬性
復(fù)制代碼 代碼如下:
img{vertical-align:top;}
透明屬性
復(fù)制代碼 代碼如下:
filter:alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5;
cursor:hand;
鼠標(biāo)換成手的形狀
復(fù)制代碼 代碼如下:
cursor:hand;
相關(guān)文章
創(chuàng)建IE各版本專屬CSS IE中的if語(yǔ)句
創(chuàng)建IE各版本專屬CSS IE中的if語(yǔ)句...2007-09-09
標(biāo)準(zhǔn)布局常見(jiàn)問(wèn)題及解決辦法
需要標(biāo)準(zhǔn)布局的朋友,經(jīng)常會(huì)遇到一些問(wèn)題,下面是一些布局問(wèn)題2008-11-11
用css filter做鼠標(biāo)滑過(guò)圖片效果
css結(jié)合filter實(shí)現(xiàn)的鼠標(biāo)滑過(guò)圖片效果代碼2008-06-06
多瀏覽器支持CSS 容器內(nèi)容超出(溢出)支持自動(dòng)換行
完美支持IE,F(xiàn)irefox,Opera等瀏覽器。2008-12-12

