Home >Web Front-end >HTML Tutorial >CSS3径向渐变大鱼吃小鱼之孤单的大鱼_html/css_WEB-ITnose

CSS3径向渐变大鱼吃小鱼之孤单的大鱼_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:20:181728browse

最近迷恋上了钓鱼,可是总钓不到大鱼,所以就画条大鱼来安慰一下我这柔弱的心灵。

先上图:

上面这个就是今晚上我要跟大家分享的小DEMO,我给他起名字就“大鱼吃小鱼之孤单的大鱼”。

转入正题,这条大鱼分为三部分:头,尾巴,眼睛。首先看一下这条鱼的框架,如下面所示,class已经说得很直接了

<div class="fish">        <div class="fisg-head"></div>        <div class="fisg-tail"></div>    </div>

首先给整条鱼做一点小小的处理

.fish{            display: inline-block;            position:relative;        }

然后就是精雕细刻了,第一步,绘制鱼头:

.fisg-head{            float: left;            width: 150px;            height: 150px;            border-radius: 100px;            background: radial-gradient(0px 100px ,rgba(255,255,255,0),rgba(255,255,255,0) 100px,white 113px,green 100px,green 100%);            background: -webkit-radial-gradient(0px 100px ,rgba(255,255,255,0),rgba(255,255,255,0) 100px,white 113px,green 100px,green 100%);            background: -moz-radial-gradient(0px 100px ,rgba(255,255,255,0),rgba(255,255,255,0) 100px,white 113px,green 100px,green 100%);            background: -ms-radial-gradient(0px 100px ,rgba(255,255,255,0),rgba(255,255,255,0) 100px,white 113px,green 100px,green 100%);            }

第二步,绘制尾巴:

.fisg-tail{            float: left;            width: 100px;            height: 100px;            transform: rotate(30deg);            -webkit-transform: rotate(30deg);            -moz-transform: rotate(30deg);            -ms-transform: rotate(30deg);            background: radial-gradient(100px 0px ,rgba(255,255,255,0),rgba(255,255,255,0) 100px,green 100px,green 100%);            background: -webkit-radial-gradient(100px 0px ,rgba(255,255,255,0),rgba(255,255,255,0) 100px,green 100px,green 100%);            background: -moz-radial-gradient(100px 0px ,rgba(255,255,255,0),rgba(255,255,255,0) 100px,green 100px,green 100%);            background: -ms-radial-gradient(100px 0px ,rgba(255,255,255,0),rgba(255,255,255,0) 100px,green 100px,green 100%);        }

最后一步,画鱼点睛

.fisg-head::after{            content:"";            display:block;            position:absolute;            top:20px;            left:35%;            width:20px;            height:20px;            border-radius:10px;            background:rgba(220, 245, 29,1);        }

radial-gradient是CSS3的新特性,这里我是用的其中一种方式去实现的这条大鱼,大家还有其它的高招不放分享出来一块,让我也开开眼界。

后续还会有其它的鱼,只有一种鱼怎么能行呢?

哈哈,12点了,碎觉

 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn