CSS3 Gradient介绍参考地址:
http://www.cnblogs.com/lhb25/archive/2013/01/30/css3-linear-gradient.html
http://www.zhangxinxu.com/wordpress/?p=3639
效果图:
html:
<div class="colorWheel"> <div class="piece"></div> </div>
css:
.colorWheel { position: relative; width: 16em; height: 16em; background: linear-gradient(36deg, #7c1 42%, transparent 42%),linear-gradient(72deg, #999 75.48%, transparent 75.48% ),linear-gradient(-36deg, #479bf6 42%, transparent 42%) 100% 0,linear-gradient(-72deg, yellow 75.48%, transparent 75.48%) 100% 0,linear-gradient(-36deg, transparent 58%, #643 58%) 0 100%,linear-gradient(-72deg, transparent 24.52%, #8a1 24.52%) 0 100%,linear-gradient(36deg, transparent 58%, #90a 42%) 100% 100%,linear-gradient(72deg,transparent 24.52%, #099 24.52%) 100% 100%,#43a1cd linear-gradient(#ba3e2e, #ba3e2e) 50% 0; background-repeat: no-repeat; background-size: 50% 50%; border:1px solid #ccc; border-radius: 50%; margin: 30px; } .piece{ position: absolute; left: 8%; top: -2.6%; width: 100%; height: 100%; background: linear-gradient(-36deg, #5454E3 42%, transparent 42%) 100% 0; background-repeat: no-repeat; background-size: 50% 50%; border-radius: 50%; }
公式来源:
html:
<div class="sixWheel"></div>
css:
.sixWheel{ width:12rem; height:12rem; margin-left: 50px; background: linear-gradient(60deg, #93f 63.4%, transparent 63.4%), linear-gradient(-60deg, #3f9 63.4%, transparent 63.4%) 100% 0, linear-gradient(-60deg, transparent 36.6%, #f63 36.6%) 0 100%, linear-gradient(60deg, transparent 36.6%, #69c 36.6%, #69c) 100% 100%, #ff9 linear-gradient(#39f, #39f) 50% 0; background-repeat: no-repeat; background-size: 50% 50%; border-radius: 50%; }
效果图:
文章是由看了文章Dig Deep Into CSS Linear Gradients引出的, 文中部分图片来自此文中图片,强烈推荐看原文!!!