[css]我要用css画幅画(八) - Hello Kitty
接着之前的[css]我要用css画幅画(七) - 哆啦A梦,这次画的是Hello Kitty。
/*
开始前先说点废话, 一转眼就2016年了,过完年后一直没更新博客,无他,就是懒得动。 这一转眼,一年就过了1/4多了。 现在依然处在迷茫状态,时间一直浪费下去也是白浪费,在找到新的目标前,暂时先继续之前做的事吧,免得时间过了又觉得可惜。 */
一点个人牢骚,可忽略
这个hello kitty画下来,非常拖沓,慢慢调样式实在太沉闷了,而且感觉只是在重复自己,所以没啥动力继续。
这次的hello kitty比哆啦A梦简单很多,本身是可以很快就完成的。 不过由于没啥动力, 画的慢,而且也粗糙。
反正终于是完成了, 先发出来, 以后有动力再调整吧。
Github Demo:http://bee0060.github.io/Css-Paint/pages/carton/hello-kitty.html
Code Pen Demo: http://codepen.io/bee0060/pen/YqePNr
代码:https://github.com/bee0060/Css-Paint
这次要临摹的图片如下:
因为哆啦A梦的经验,这次已经感觉并不困难,而且发现哆啦A梦的CSS中有部分样式可以重用, 于是我把这些样式抽出来做成公用样式,并引用进来,公用样式如下:
/*位置选择器*/
.clearfix {
clear: both;
} .pos-a {
position: absolute;
} .pos-r {
position: relative;
} .pull-left {
float: left;
} .pull-right {
float: right;
} .m-hoz-auto {
margin-left: auto;
margin-right: auto;
} .left-32 {
left: 32px;
} .left-5 {
left: 5px;
} .top-30 {
top: 30px;
} /*形状选择器*/
.circle {
border-radius: 50%;
} /*样式选择器*/
.bacc-white {
background-color: white;
} .bacc-black {
background-color: black;
} .bacc-blue {
background-color: rgb(2, 159, 227);
} .bacc-brown-red {
background-color: rgb(216, 5, 23);
} .bacc-mouse-red {
background-color: #E80115;
} .bacc-mouse-orange {
background-color: #EF6C1C;
} .bacc-bell-yellow {
background-color: #F5D600;
} .border-black-1 {
border: 1px solid black;
} .border-black-2 {
border: 2px solid black;
} .border-black-3 {
border: 3px solid black;
} .oh {
overflow: hidden;
}
common.css
其中有小部分可重用,部分样式就不需要重新写了。 之前颗粒化的写样式,为这次的画带来了一点便利。 但我也感觉到,要让css的重用率更高,还需要更多思考和实践,目前的效果还不算好。
这次画的策略主要是用颜色的遮盖,例如身体,实现步骤如下:
1. 先画一个纯黑的身体形状
<div class="pos-r">
<div class="body-left pos-r pull-left"></div>
<div class="body-right pos-r pull-left"></div>
</div>
html
.body-left {
background-color: #000;
border: 12px solid #000;
border-top-left-radius: 90% 100%;
border-bottom-left-radius: 70% 50%;
border-bottom-right-radius: 60% 20%; height: 240px;
margin-left: 125px;
margin-top: -43px;
width: 135px;
z-index:;
} .body-right {
background-color: #000;
border: 12px solid #000;
border-top-right-radius: 100% 90%;
border-bottom-left-radius: 60% 20%;
border-bottom-right-radius: 70% 50%; height: 240px;
margin-left: -46px;
margin-top: -43px;
width: 135px;
z-index:;
}
css
2. 画粉红色的T恤盖上去
<div class="pos-r">
<div class="shirt-left pos-r pull-left">
</div>
<div class="shirt-right pos-r pull-left">
</div>
</div>
html
.shirt-left {
background-color: rgb(250, 167, 209);
border-top-left-radius: 100% 100%;
border-bottom-left-radius: 70% 50%;
border-bottom-right-radius: 60% 20%; height: 240px;
margin-left: 140px;
margin-top: -254px;
width: 135px;
z-index:;
} .shirt-right {
background-color: rgb(250, 167, 209);
border-top-right-radius: 115% 105%;
border-bottom-left-radius: 60% 20%;
border-bottom-right-radius: 70% 50%; height: 240px;
margin-left: 245px;
margin-top: -254px;
width: 135px;
z-index:;
}
css
3. 画桃红色的领口盖上去
<div class="neck pos-r"></div>
html
.neck {
background-color: rgb(245, 74, 153);
border: 12px solid #000;
border-radius: 50%; height: 110px;
margin-left: 195px;
margin-top: -72px;
width: 100px;
z-index:;
}
css
4. 画白色的双脚盖上去(为了遮盖,放在了右边T恤的div里)
<div class="shirt-right pos-r pull-left">
<div class="feet-left pos-a pull-left"></div>
<div class="feet-right pos-a pull-left"></div>
</div>
html
.feet-left {
background-color: white;
border: 12px solid #000;
border-bottom-left-radius: 60% 100%;
border-bottom-right-radius: 30% 50%; height: 60px;
margin-left: -118px;
margin-top: 170px;
width: 115px;
z-index:;
} .feet-right {
background-color: white;
border: 12px solid #000;
border-bottom-left-radius: 30% 50%;
border-bottom-right-radius: 60% 100%; height: 60px;
margin-left: 10px;
margin-top: 170px;
width: 115px;
z-index:;
}
css
命名也遵照之前的规则,每个组件的命名都尽量可读。
这次画出来的比较粗糙, 和原图的区别还是比较明显的, 希望不会恶心到观众。 哈哈。
关键html:
<div class="container pos-r pull-left">
<div class="ear-left pos-a pull-left"></div>
<div class="ear-right pos-a pull-left"></div>
<div class="flower pos-a">
<div class="leaf leaf-1 pos-a"></div>
<div class="leaf leaf-2 pos-a"></div>
<div class="leaf leaf-3 pos-a"></div>
<div class="leaf leaf-4 pos-a"></div>
<div class="leaf leaf-5 pos-a"></div>
<div class="flower-center pos-a">
<div class="flower-heart"></div>
</div>
</div>
<div class="head pos-r">
<div class="eye eye-left pos-a"></div>
<div class="eye eye-right pos-a"></div>
<div class="nose pos-r"></div>
<div class="bread-left-1 pos-a oh">
<div class="bread-left-1-inside"></div>
</div>
<div class="bread-left-2 pos-a oh">
<div class="bread-left-2-inside"></div>
</div>
<div class="bread-left-3 pos-a oh">
<div class="bread-left-3-inside"></div>
</div>
<div class="bread-right-1 pos-a oh">
<div class="bread-right-1-inside"></div>
</div>
<div class="bread-right-2 pos-a oh">
<div class="bread-right-2-inside"></div>
</div>
<div class="bread-right-3 pos-a oh">
<div class="bread-right-3-inside"></div>
</div>
</div>
<div class="pos-r">
<div class="body-left pos-r pull-left"></div>
<div class="body-right pos-r pull-left"></div>
</div>
<div class="neck pos-r"></div>
<div class="pos-r">
<div class="shirt-left pos-r pull-left">
</div>
<div class="shirt-right pos-r pull-left">
<div class="feet-left pos-a pull-left"></div>
<div class="feet-right pos-a pull-left"></div>
</div>
</div>
<div class="left-hand pos-a">
<div class="left-arm-shirt"></div>
<div class="left-finger">
<div class="left-finger-inside"></div>
</div>
</div>
<div class="right-hand pos-a">
<div class="right-arm-shirt"></div>
<div class="right-finger">
<div class="right-finger-inside"></div>
</div>
</div>
</div>
关键css:
/*卡通组件*/
.container {
height: 700px;
width: 600px;
} .ear-left {
border:15px solid #000;
border-top-left-radius: 30%;
border-top-right-radius: 100%;
border-bottom-left-radius: 90%;
height: 130px;
margin-top: 42px;
margin-left: 80px;
width: 130px; z-index:;
-webkit-transform: rotate(5deg);
-webkit-transform-origin: left top;
} .ear-right {
border:15px solid #000;
border-top-left-radius: 80% 65% ;
border-top-right-radius: 15%;
border-bottom-right-radius: 25% 95%;
height: 100px;
margin-top: 30px;
margin-left: 255px;
width: 130px; z-index:;
-webkit-transform: rotate(-10deg);
-webkit-transform-origin: right top;
} .flower {
margin-top: -8px;
margin-left: 230px;
} .leaf {
background-color: rgb(245, 74, 153);
border: 12px solid #000;
border-top-left-radius: 40px 45px;
border-top-right-radius: 40px 45px;
width: 40px; border-bottom-color: rgb(245, 74, 153);
z-index:;
} .leaf-1 {
height: 55px;
margin-left: 9px;
margin-top: 17px;
-webkit-transform: rotate(-30deg);
} .leaf-2 {
height: 50px;
margin-left: 84px;
margin-top: 30px;
-webkit-transform: rotate(50deg);
} .leaf-3 {
height: 45px;
margin-left: 89px;
margin-top: 98px;
-webkit-transform: rotate(120deg);
} .leaf-4 {
height: 45px;
margin-left: 30px;
margin-top: 125px;
-webkit-transform: rotate(190deg);
} .leaf-5 {
height: 50px;
margin-left: -18px;
margin-top: 78px;
width: 40px;
-webkit-transform: rotate(-105deg);
} .flower-center {
background-color: rgb(245, 74, 153);
border-radius: 50%;
height: 82px;
margin-top: 64px;
margin-left: 21px;
width: 95px;
z-index:;
} .flower-heart {
background-color: rgb(245, 180, 4);
border: 9px solid #000;
border-radius: 50%;
height: 23px;
margin: 20px 25px;
width: 23px;
} .head{
background-color: #fff;
border: 15px solid #000;
border-top-left-radius: 50% 60%;
border-top-right-radius: 50% 60%;
border-bottom-left-radius: 51% 48%;
border-bottom-right-radius: 51% 48%; height: 260px;
margin-top: 60px;
margin-left: 60px;
width: 355px; z-index:;
} .eye {
background-color: #000;
border-radius: 50%;
height: 40px;
width: 30px;
} .eye-left {
margin-top: 125px;
margin-left: 70px;
} .eye-right {
margin-top: 125px;
margin-left: 250px;
} .nose {
background-color: rgb(245, 180, 4);
border: 8px solid #000;
border-radius: 50%;
height: 18px;
left: -20px;
margin-top: 165px;
margin-left: 50%;
top: 10px;
width: 30px;
} .bread-left-1 {
border: 0px solid #fff;
border-radius: 50%;
margin-top: -75px;
margin-left:-70px;
height: 15px;
width: 95px; -webkit-transform: rotate(5deg);
-webkit-transform-origin: right top;
} .bread-left-1-inside {
border: 12px solid #000;
border-radius: 50%;
height: 70px;
margin-left:-70px;
width: 205px;
} .bread-left-2 {
border: 0px solid #fff;
border-radius: 50%;
margin-top: -43px;
margin-left:-60px;
height: 15px;
width: 77px; -webkit-transform: rotate(-5deg);
-webkit-transform-origin: right top;
} .bread-left-2-inside {
border: 12px solid #000;
border-radius: 50%;
height: 70px;
margin-left:-70px;
width: 205px;
} .bread-left-3 {
border: 0px solid #fff;
border-radius: 50%;
margin-top: -15px;
margin-left:-50px;
height: 15px;
width: 78px; -webkit-transform: rotate(-19deg);
-webkit-transform-origin: right top;
} .bread-left-3-inside {
border: 12px solid #000;
border-radius: 50%;
height: 70px;
margin-left:-70px;
width: 205px;
} .bread-right-1 {
border: 0px solid #fff;
border-radius: 50%;
margin-top: -80px;
margin-left:325px;
height: 15px;
width: 95px; -webkit-transform: rotate(-5deg);
-webkit-transform-origin: left top;
} .bread-right-1-inside {
border: 12px solid #000;
border-radius: 50%;
height: 70px;
margin-left:-70px;
width: 205px;
} .bread-right-2 {
border: 0px solid #fff;
border-radius: 50%;
margin-top: -48px;
margin-left:332px;
height: 15px;
width: 72px; -webkit-transform: rotate(4deg);
-webkit-transform-origin: left top;
} .bread-right-2-inside {
border: 12px solid #000;
border-radius: 50%;
height: 70px;
margin-left:-70px;
width: 205px;
} .bread-right-3 {
border: 0px solid #fff;
border-radius: 50%;
margin-top: -14px;
margin-left:325px;
height: 15px;
width: 80px; -webkit-transform: rotate(19deg);
-webkit-transform-origin: left top;
} .bread-right-3-inside {
border: 12px solid #000;
border-radius: 50%;
height: 70px;
margin-left:-70px;
width: 205px;
} .body-left {
background-color: #000;
border: 12px solid #000;
border-top-left-radius: 90% 100%;
border-bottom-left-radius: 70% 50%;
border-bottom-right-radius: 60% 20%; height: 240px;
margin-left: 125px;
margin-top: -43px;
width: 135px;
z-index:;
} .body-right {
background-color: #000;
border: 12px solid #000;
border-top-right-radius: 100% 90%;
border-bottom-left-radius: 60% 20%;
border-bottom-right-radius: 70% 50%; height: 240px;
margin-left: -46px;
margin-top: -43px;
width: 135px;
z-index:;
} .neck {
background-color: rgb(245, 74, 153);
border: 12px solid #000;
border-radius: 50%; height: 110px;
margin-left: 195px;
margin-top: -72px;
width: 100px;
z-index:;
} .shirt-left {
background-color: rgb(250, 167, 209);
border-top-left-radius: 100% 100%;
border-bottom-left-radius: 70% 50%;
border-bottom-right-radius: 60% 20%; height: 240px;
margin-left: 140px;
margin-top: -254px;
width: 135px;
z-index:;
} .shirt-right {
background-color: rgb(250, 167, 209);
border-top-right-radius: 115% 105%;
border-bottom-left-radius: 60% 20%;
border-bottom-right-radius: 70% 50%; height: 240px;
margin-left: 245px;
margin-top: -254px;
width: 135px;
z-index:;
} .feet-left {
background-color: white;
border: 12px solid #000;
border-bottom-left-radius: 60% 100%;
border-bottom-right-radius: 30% 50%; height: 60px;
margin-left: -118px;
margin-top: 170px;
width: 115px;
z-index:;
} .feet-right {
background-color: white;
border: 12px solid #000;
border-bottom-left-radius: 30% 50%;
border-bottom-right-radius: 60% 100%; height: 60px;
margin-left: 10px;
margin-top: 170px;
width: 115px;
z-index:;
} .left-hand {
background-color: white;
border: 12px solid #000; border-radius: 50%; height: 70px;
margin-left: 45px;
margin-top: -30px;
width: 125px;
z-index:; -webkit-transform: rotate(-30deg);
-webkit-transform-origin: left top;
} .left-arm-shirt{
background-color: rgb(245, 74, 153);
border: 12px solid #000;
border-radius: 50%;
border-top-left-radius: 0%;
border-top-right-radius: 100% 60%; height: 70px;
margin-left: 57px;
margin-top: -7px;
width: 60px;
z-index:;
} .left-finger {
height: 32px;
margin-left: -2px;
margin-top: -103px;
overflow: hidden;
width: 50px; -webkit-transform: rotate(-18deg);
-webkit-transform-origin: left top;
} .left-finger-inside {
background-color: white;
border: 12px solid #000;
border-radius: 50%;
height: 30px;
margin-top: 6px;
width: 25px;
z-index:;
} .right-hand {
background-color: white;
border: 12px solid #000; border-radius: 50%; height: 70px;
margin-left: 320px;
margin-top: -37px;
width: 125px;
z-index:; -webkit-transform: rotate(28deg);
-webkit-transform-origin: right top;
} .right-arm-shirt{
background-color: rgb(245, 74, 153);
border: 12px solid #000;
border-radius: 50%;
border-top-right-radius: 0%;
border-top-left-radius: 100% 60%; height: 70px;
margin-left: -15px;
margin-top: -7px;
width: 60px;
z-index:;
} .right-finger {
height: 32px;
margin-left: 78px;
margin-top: -103px;
overflow: hidden;
width: 50px; -webkit-transform: rotate(18deg);
-webkit-transform-origin: right top;
} .right-finger-inside {
background-color: white;
border: 12px solid #000;
border-radius: 50%;
height: 30px;
margin-top: 6px;
width: 25px;
z-index:;
}
Github Demo:http://bee0060.github.io/Css-Paint/pages/carton/hello-kitty.html
CodePen Demo: http://codepen.io/bee0060/pen/YqePNr
代码:https://github.com/bee0060/Css-Paint
有任何问题或意见,欢迎交流。
如果发现本文有什么问题(如错别字),请不吝告知,谢谢。
这次的博客可能有点滥竽充数,请见谅。希望短期内能想到其他有意思的东西来打发时间。:)
转载请注明出处:[css]我要用css画幅画(八) - Hello Kitty
[css]我要用css画幅画(八) - Hello Kitty的更多相关文章
- [css]我要用css画幅画(九) - Apple Logo
接着之前的[css]我要用css画幅画(八) - Hello Kitty,这次画的是苹果公司的logo 这次打算将分析和实现步骤尽量详细的说一说. 其实之前的也打算详细讲分析和设计过程,不过之前的图比 ...
- [css]我要用css画幅画(七) - 哆啦A梦
接着之前的[css]我要用css画幅画(六),今天画的有所不同,画的是哆啦A梦,我们小时候对他的称呼其实是小叮当机器猫. (PS:这次我要做的事情,很多人已经做过,这并不是什么创新,我只是在学习并记录 ...
- [css]我要用css画幅画(六)
接着之前的[css]我要用css画幅画(五), 由于这个画已经画了很久了,这次一次性加了比较多更新,算是让这幅画告一段落吧. 本次的更新包括: 1. 给云增加动画 2. 画了一棵树 3. 树上画了一个 ...
- [css]我要用css画幅画(五)
接着之前的[css]我要用css画幅画(四), 这次我给小明和静静增加了对话,用了简单的动画效果. github:https://github.com/bee0060/Css-Paint , 完整代码 ...
- [css]我要用css画幅画(四)
接着之前的[css]我要用css画幅画(三), 今天,我画了两朵云,并给小明介绍了个朋友:静静. github:https://github.com/bee0060/Css-Paint , 完整代码在 ...
- [css]我要用css画幅画(三)
接着之前的[css]我要用css画幅画(二), 今天,我画了一个小人,他的名字暂时叫作小明. 以下只列出本次修改增加的内容 html如下: <div class="human left ...
- [css]我要用css画幅画(二)
接着之前的[css]我要用css画幅画(一) , 今天,我又画一个房子,很简单,屋顶.墙壁.门. 现在开始,做得效果都只兼容chrome,所以下面的css3的属性可能只有-webkit-前缀. 我只是 ...
- [css]我要用css画幅画(一)
几年前开始就一直想用css画幅画. 今天才真正开始, 从简单的开始. 作为一个工作压力那么大的程序员,我首先要画一个太阳. html如下: <!DOCTYPE html> <html ...
- 【html、CSS、javascript-5】css应用场景补充
一.CSS全局应用 父标签div下包含两个子标签div,当子标签dvi全部向左float,此时父标签设置的背景色是不显示的 <!DOCTYPE html> <html lang=&q ...
随机推荐
- Expression Template(表达式模板,ET)
1.前言 在前一篇文章自己实现简单的string类中提到在实现+操作符重载函数时,为了防止返回时生成的临时对象调用拷贝构造函数动态申请内存空间,使用了一个叫move的函数,它是C++0x新增的特性.既 ...
- Windows 搭建 .NET 跨平台环境并运行应用程序
写在前面 阅读目录: Install .NET Version Manager (DNVM) Install .NET Core Execution Environment (DNX) Write t ...
- 相克军_Oracle体系_随堂笔记004-shared pool
本章主要阐述SGA中的shared pool. Shared pool { 1.free 2.library cache(缓存sql语句及其执行计划) 3.row cache(数据字典缓存) } ...
- 自己动手丰衣足食之 jQuery 数量加减插件
引言 做一个手机端的订单相关项目中,其中下订单时需要用到数量加减的控件,可以设置默认值,也可以设置最大值和最小值.使用jQuery这么长时间了,平时很少去编写属于自己的插件,现在编写的时候对立面的一些 ...
- jQuery效率提升建议
jQuery简洁通用的方法集把编码者从繁重的工作中解脱出来,也拉低了进入javascript的门槛,初学者对浏览器兼容性一无所知的情况下,几行代码就可以写出超炫的特效.网上有一篇文章转载比较泛滥,已经 ...
- SetZOrder 无效
<SetZOrder的BUG描述>1.部分情况下会出现SetZOrder无效的情况,原因是,你需要调整的对象的父节点是CCSprite2.在调用setZOrder方法的时候.会调用_set ...
- ASP.NET开源CMS
CMS这里指 内容管理系统.是Content Management System的缩写. 产生 随着网络应用的丰富和发展,很多网站往往不能迅速跟进大量信息衍生及业务模式变革的脚步,常常需要花费许多时间 ...
- IIS 配置Http重定向到Https
注意首先要安装url重定向模块 https://www.microsoft.com/zh-CN/download/details.aspx?id=7435 然后在web.config末尾添加如下 ...
- PHP中return 和 exit 、break和contiue 区别与用法
先说一下exit函数的用法. 作用: 输出一则消息并且终止当前脚本. 如果一段文本中包括多个以 结束的脚本,则exit退出当前所在脚本. 比如一篇php文本包括一下代码,则输出为world. < ...
- PHP工作笔记:使用yii migrate管理、生成数据库
第一步:进入yii migrate 通过dos(我是win7系统,其他系统类似,就是进入字符界面)打开网站目录 phpStudy/WWW/local/ddc_dlss 输入 ./yii migrate ...