DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> HTML基礎知識 >> HTML5特效代碼 >> 純CSS畫出好看立體環形
純CSS畫出好看立體環形
編輯:HTML5特效代碼     
就是在地面上打鑿出凹的圓環效果,利用linear-gradient線性漸變增強內環質感,再用偽類after元素設置中心圓凸塊的位置以及大小與跟內環之間的陰影度,然後設置內環的顏色就行了;第四個環上面的第二小凸塊也同樣適用偽類after元素然後設置z-index的順序。

在linear-gradient段內可以見到各種浏覽器支持提示,Firefox Chrome完美效果,IE8以下效果不怎麼樣, 如果IE采用css3pie.com的htc插件應該會好一些。

點擊這裡查看效果

代碼如下:

<style>body,html{
height:100%; width: 100%;
}
body{
font-size: 100%;
background-color: #ddd;
color: #524d46;
text-align: center;
}


.circlegraph {display: block; width: 12em; height: 12em; border-radius: 50%; box-shadow: .30em .375em .625em rgba(0,0,0,.25) inset, 0em 0em 1.25em rgba(0,0,0,.2) inset; position: absolute; left: 50%; top: 50%; margin-left: -6em; margin-top: -6em;

background: -moz-linear-gradient(top, rgba(0,0,0,0.2) 0%, rgba(255,255,255,0.2) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.2)), color-stop(100%,rgba(255,255,255,0.2))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(0,0,0,0.2) 0%,rgba(255,255,255,0.2) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(0,0,0,0.2) 0%,rgba(255,255,255,0.2) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(0,0,0,0.2) 0%,rgba(255,255,255,0.2) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%,rgba(255,255,255,0.2) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#33000000', endColorstr='#33ffffff',GradientType=0 ); /* IE6-9 */

}

.circlegraph:after {display: block; content: ""; width: 8em; height: 8em; background-color: #f9f8f4; border-radius: 50%; position: absolute; left: 2em; top: 2em; box-shadow: 0 0 1em rgba(0,0,0,.25);}

.white {margin-left:-500px;}
.blue {background-color: #26b7ff;margin-left:-250px;}
.orange {background-color: #ff9300;margin-left:0px;}
.red {background-color: #DE6040;margin-left:250px;}
.above:after {display: block; content: ""; width: 4em; height: 4em; background-color: #fff; border-radius: 50%; position: absolute; left: 4em; top: 4em; box-shadow: 0.1em 0.4em 0.5em rgba(0,0,0,.25);z-index: 1;}</style>
<div class="circlegraph white"></div>
<div class="circlegraph orange"></div>
<div class="circlegraph blue"></div>
<div class="circlegraph red"><div class="above"></div></div>


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