DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> CSS入門知識 >> CSS特效代碼
好用的一些 CSS 樣式片段
編輯:CSS特效代碼     

1. 垂直對齊

.vc { position: relative; top: 50%; -webkit-transform: translateY(-50%); -o-transform: translateY(-50%); transform: translateY(-50%); }

2. 漸變背景動畫效果

button {
padding: 15px;
background-image: linear-gradient(#FC6E51, #FFF);
background-size: auto 200%;
background-position: 0 100%;
transition: background-position 0.5s;
}
button:hover { background-position: 0 0; }

3. CSS 投影

// 外投影
.shadow {
-moz-box-shadow: 5px 5px 5px #ccc;
-webkit-box-shadow: 5px 5px 5px #ccc;
box-shadow: 5px 5px 5px #ccc;
}
// 內投影
.shadow {
-moz-box-shadow: inset 0 0 10px #000000;
-webkit-box-shadow: inset 0 0 10px #000000;
box-shadow: inset 0 0 10px #000000;
}

4. 固定 Footer

#footer {
position: fixed; left: 0px; bottom: 0px;
height: 30px; width: 100%; background: #999;
}
/* IE 6 */
* html #footer {
position: absolute;
top: expression((0-(footer.offsetHeight)+(document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight)+(ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop))+'px');
}

5. 移除 IE 中 textarea 的捲動軸

textarea { overflow: auto; }

6. 居中未知寬度的 DIV 元素

.content { margin: 0 auto 8px; display: table; }
.content div { display: table-cell; }
<!--[if IE]>
.content { display: block; text-align: center; }
.content div { display: inline; zoom: 1; }
<![endif]-->
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved