DIV CSS 佈局教程網

您现在的位置: DIV+CSS佈局教程網 >> 網頁腳本 >  >> HTML基礎知識 >> HTML和Xhtml
HTML5+CSS3 實戰:用純 CSS 製作網頁播放器按鈕
編輯:HTML和Xhtml     

最近開始學習 HTML5 與 CSS3,趁機練習了一下,用純 CSS 繪製了幾個播放器按鈕。若有更好的建議,歡迎指正。

<!DOCTYPE>
<html>
<head>
<meta charset="utf-8" />
<style>
body{ background:#000; }
header{ font-family:"MicroSoft YaHei"; font-size:30px; color:#990000; }
.circle{ width:120px; height:120px; -webkit-border-radius:60px; -moz-border-radius:60px; border-radius:60px; border:2px #FFF solid; float:left; margin:10px; cursor:pointer; }
.circle:hover,.circle1:hover{ -webkit-box-shadow:rgba(255,255,255,0.6) 0 0 15px; -moz-box-shadow:rgba(255,255,255,0.6) 0 0 15px; box-shadow:rgba(255,255,255,0.6) 0 0 15px; }
.circle1{ width:140px; height:140px; -webkit-border-radius:70px; -moz-border-radius:70px; border-radius:70px; border:2px #FFF solid; float:left; cursor:pointer; }
.triangleRight{ width: 0; height: 0; border-left: 60px solid #FFF; border-top: 30px solid transparent; border-bottom: 30px solid transparent; -webkit-transform:scale(0.6,1.2); -moz-transform:scale(0.6,1.2); transform:scale(0.6,1.2); }
.next1{ margin:30px -10px 0 20px; float:left; }
.next2{ margin:30px 0 0 -20px; float:left; }
.triangleleft{ width: 0; height: 0; border-Right: 60px solid #FFF; border-top: 30px solid transparent; border-bottom: 30px solid transparent; -webkit-transform:scale(0.6,1.2); -moz-transform:scale(0.6,1.2); transform:scale(0.6,1.2); }
.pre1{ margin:30px -10px 0 10px; float:left; }
.pre2{ margin:30px 0 0 -20px; float:left; }
.pause{ width:20px; height:80px; background:#FFF; float:left; }
.pause1{ margin:30px 10px 0 40px; }
.pause2{ margin:30px 10px 0 10px; }
</style>
</head>
<body>
<header>播放器按鈕</header><section>
<div class="circle">
<div class="triangleLeft pre1"></div>
<div class="triangleLeft pre2"></div>
</div>
<div class="circle1">
<div class="pause pause1"></div>
<div class="pause pause2"></div>
</div>
<div class="circle">
<div class="triangleRight next1"></div>
<div class="triangleRight next2"></div>
</div>
</section>
</body>
</html>

這組按鈕以圓角 circle 為底,內含由邊框繪製的三角形(上一首、下一首)與矩形(暫停),並搭配 hover 陰影與 transform 縮放,完全以純 CSS 呈現,沒有使用任何圖片。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved