CSS 原来可以这样写(一)

转自:小月博客 http://www.aliyue.net/652.html


1. 文字换行

/*强制不换行*/

white-space:nowrap;

/*自动换行*/

word-wrap: break-word;

word-break: normal;

/*强制英文单词断行*/

word-break:break-all;

2. 两端对齐

text-align:justify;text-justify:inter-ideogra

3. 去掉Webkit(chrome)浏览器中input(文本框)或textarea的黄色焦点框

input,button,select,textarea{ outline:none;}

textarea{ font-size:13px; resize:none;}

注:去掉chrome记住密码后自动填充表单的黄色背景

4. ie6: position:fixed

.fixed-top /* position fixed Top */{position:fixed;bottom:auto;top:0; }

* html .fixed-top /* IE6 position fixed Top */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}

*html{background-image:url(about:blank);background-attachment:fixed;}

5. clearfix

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

.clearfix{display:inline-block;}

html[xmlns] .clearfix{display:block;}

* html .clearfix{height:1%;}


.clearfix{*zoom: 1;}

.clearfix:after{clear:both;display:table;content:"”;}


.clearfix{overflow:hidden;_zoom:1;}

6. min-height: 最小高度兼容代码

.minheight500{

min-height:500px;

height:auto !important;

height:500px;

overflow:visible;

}

7. 鼠标不允许点击:

cursor:not-allowed;

8. mac font: osx平台字体优化

font-family:"Hiragino Sans GB","Hiragino Sans GB W3",'微软雅黑';

9. 省略号:

.ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

你可能感兴趣的:(CSS 原来可以这样写(一))