导航首页 » 技术教程 » 顶级经典常用的CSS属性收集整理
顶级经典常用的CSS属性收集整理 68 2024-04-02   

文本两端对齐:

text-align:justify;
text-justify:inter-ideograph;


清除浮动:

.clear{clear:both;line-height:0;height:0;font-size:0;}


清除浮动伪类:

.clearfix:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}


设置不让单词断开

word-break : keep-all


字符自动换行

word-break:keep-all;word-break:break-all;word-wrap:break-word


使用 line-height 垂直居中


line-height:24px;/*使用固定宽度的容器并且需要一行垂直居中时,使用 line-height 即可(高度与父层容器一致),更多的垂直居中总结可以看这里。
*/


清除容器浮动


#main {overflow:hidden;}


不让链接折行


a {white-space:nowrap;}


始终让 Firefox 显示滚动条


html {overflow:-moz-scrollbars-vertical;}

使块元素水平居中


body, html {min-height:101%;}或者margin:0 auto;


隐藏 Exploer textarea 的滚动条


textarea {overflow:auto;}


设置打印分页

h2 {page-break-before:always;}/*设置打印网页时的分页*/


删除链接上的虚线框

a,area { blr:e­xpression(this.onFocus=this.blur()) }
:focus { -moz-outline-style: none; }

最简单的 CSS 重置

* {margin: 0; padding: 0}/*此属性慎用,虽然能消除默认属性,但是对浏览器渲染有影响,而且在语义化表达上也欠佳。*/


图片回车后打文字需要属性


img{vertical-align:top;}

透明属性


filter:alpha(opacity=50); -moz-opacity: 0.5; opacity: 0.5;
cursor:hand;


鼠标换成手的形状

cursor:hand;


!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103