標籤:
1、每逢大的災難的時候,很多網站變成了灰色,如何讓網站快速變灰?css代碼是很簡單的,用的是css的filter功能。
html { filter: grayscale(100%);//IE瀏覽器 -webkit-filter: grayscale(100%);//Google瀏覽器 -moz-filter: grayscale(100%);//Firefox -ms-filter: grayscale(100%); -o-filter: grayscale(100%); filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); -webkit-filter: grayscale(1);//Google瀏覽器}
有一些網站FLASH動畫的顏色不能被CSS濾鏡控制,可以在FLASH代碼的和之間插入:
<param value="false" name="menu"/><param value="opaque" name="wmode"/>
2.DIV可編輯,就是讓一個div變成一個類似input輸入框的效果。
在div中添加contentEditable="true" 屬性就可以了,如下:
<div id="div1" contentEditable="true" ></div> <div id="div2" contentEditable="true" ></div> <div contentEditable="true" id="div3"></div>
3、有些網站為了不讓使用者複製,設定了div禁止選擇的功能,設定如下屬性:
<div unselectable="on" onselectstart="return false;">sdfsdfswerwer324234234234</div>
5、input聲音錄入按鈕,(緊支援Google)
<input type="text" class="box" name="s" id="s" class="inputText" placeholder="輸入關鍵詞" x-webkit-speech>
6、給input的placeholder設定顏色
::-webkit-input-placeholder { /* WebKit browsers */ color: #999;}:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #999;}::-moz-placeholder { /* Mozilla Firefox 19+ */ color: #999;}:-ms-input-placeholder { /* Internet Explorer 10+ */ color: #999;}
7透明度
.haorooms{opacity: 0; cursor:pointer; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";filter: alpha(opacity=0);}
背景顏色設定透明時代碼如下,IE8以下不支援,要去這個地址把startColorstr,endColorstr 轉換。http://kilianvalkhof.com/2010/css-xhtml/how-to-use-rgba-in-ie/
.caption{ position: absolute;background:rgba(226,105,116,0.8);left: 0; top:0;display: none;color:#ffffff;height:100%;width:182px;padding:0 12px 0 13px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#e26974",endColorstr="#e26974");}
8超出長度顯示省略符號
display:bolck;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;
9.CSS強制換行和不換行
自動換行:word-wrap: break-word; word-break: normal;
強制英文單詞斷行:word-break:break-all;
強制不換行:white-space:nowrap;
10.css3彈性盒子
#haorooms ul { //父親 display: -moz-box; display: -webkit-box; display: box; -moz-box-orient: horizontal; -webkit-box-orient: horizontal; box-orient: horizontal; } #haorooms ul li{ //兒子設定 -moz-box-flex: 1; -webkit-box-flex: 1; box-flex: 1; float:none;}
本文摘自:http://www.haorooms.com/post/css_common
css常用總結