CSS图形每日一练(下)

1. 心形(Heart)

#heart {
  position: relative;
  width: 100px;
  height: 90px;
}
#heart::before,
#heart::after {
  position: absolute;
  content: '';
  top: 0;
  left: 50px;
  width: 50px;
  height: 80px;
  background: red;
  border-radius: 50px 50px 0 0;
  transform: rotate(-45deg);
  transform-origin: 0 100%;
}
#heart::after {
  left: 0;
  transform: rotate(45deg);
  transform-origin: 100% 100%;
}
heart.png

2. 无穷(Infinity)

#infinity {
  position: relative;
  width: 212px;
  height: 100px;
  box-sizing: content-box;
}
#infinity::before,
#infinity::after {
  position: absolute;
  content: '';
  box-sizing: content-box;
  top: 0;
  left: 0;
  width: 60px;
  height: 60px;
  border: 20px solid red;
  border-radius: 50px 50px 0 50px;
  transform: rotate(-45deg);
}
#infinity::after {
  left: auto;
  right: 0;
  border-radius: 50px 50px 50px 0;
  transform: rotate(45deg);
}
infinity.png

3. 鸡蛋形(Egg)

#egg {
  display: block;
  width: 126px;
  height: 180px;
  background: red;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
egg.png

4. 吃豆人(Pac-Man)

#pacman {
  width: 0;
  height: 0;
  border: 60px solid red;
  border-right-color: transparent;
  border-radius: 60px;
}
pacman.png

5. 聊天框(Talk Bubble)

#talkbubble {
  width: 120px;
  height: 80px;
  background: red;
  border-radius: 10px;
  position: relative;
  margin: 0 20px;
}
#talkbubble::before {
  position: absolute;
  content: '';
  top: 26px;
  right: 100%;
  width: 0;
  height: 0;
  border-top: 13px solid transparent;
  border-right: 17px solid red;
  border-bottom: 13px solid transparent;
}
talkbubble.png

6. 六角星(Star (6-points))

#star-six {
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 100px solid red;
  position: relative;
}
#star-six::after {
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-top: 100px solid red;
  position: absolute;
  content: '';
  top: 30px;
  left: -50px;
}
star-six.png

7. 五角星(Star(5-points))

#star-five {
  width: 0;
  height: 0;
  border-left: 100px solid transparent;
  border-right: 100px solid transparent;
  border-bottom: 70px solid red;
  position: relative;
  transform: rotate(35deg);
  margin: 60px 0;
}
#star-five::before {
  width: 0;
  height: 0;
  border-left: 30px solid transparent;
  border-right: 30px solid transparent;
  border-bottom: 80px solid red;
  position: absolute;
  content: '';
  top: -45px;
  left: -65px;
  transform: rotate(-35deg);
}
#star-five::after {
  width: 0;
  height: 0;
  border-left: 100px solid transparent;
  border-right: 100px solid transparent;
  border-bottom: 70px solid red;
  position: absolute;
  content: '';
  top: 3px;
  left: -105px;
  transform: rotate(-70deg);
}
star-five.png

8. 爆炸形状1(12 Point Burst)

#burst-12 {
  width: 80px;
  height: 80px;
  background: red;
  position: relative;
}
#burst-12::before,
#burst-12::after {
  position: absolute;
  content: '';
  top: 0;
  left: 0;
  width: 80px;
  height: 80px;
  background: red;
}
#burst-12::before {
  transform: rotate(30deg);
}
#burst-12::after {
  transform: rotate(60deg);
}
burst-12.png

9. 爆炸形状2(8 Point Burst)

#burst-8 {
  width: 80px;
  height: 80px;
  background: red;
  position: relative;
  transform: rotate(20deg);
}
#burst-8::before {
  width: 80px;
  height: 80px;
  background: red;
  position: absolute;
  content: '';
  top: 0;
  left: 0;
  transform: rotate(135deg);
}
burst-8.png

10. 阴阳(Yin Yang)

#yin-yang {
  width: 100px;
  height: 100px;
  background: linear-gradient(to bottom, #000 0%,#000 50%,#fff 50%,#fff 100%);
  border-radius: 50%;
  border: 1px solid black;
  position: relative;
}
#yin-yang::before {
  position: absolute;
  content: '';
  top: 25px;
  left: 0;
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  border: 20px solid black;
  box-sizing: content-box;
}
#yin-yang::after {
  position: absolute;
  content: '';
  top: 25px;
  left: 50px;
  width: 10px;
  height: 10px;
  background: black;
  border: 20px solid white;
  border-radius: 50%;
  box-sizing: content-box;
}
yinyang.png

11. 徽章丝带(Badge Ribbon)

#badge-ribbon {
  width: 100px;
  height: 100px;
  background: red;
  border-radius: 50px;
  position: relative;
}
#badge-ribbon::before,
#badge-ribbon::after {
  position: absolute;
  content: '';
  top: 70px;
  left: -10px;
  border-left: 40px solid transparent;
  border-right: 40px solid transparent;
  border-bottom: 70px solid red;
  transform: rotate(-140deg);
}
#badge-ribbon::after {
  left: auto;
  right: -10px;
  transform: rotate(140deg);
}
badge-ribbon.png

12. 电视屏幕(TV Screen)

#tv {
  width: 200px;
  height: 150px;
  position: relative;
  background: red;
  border-radius: 50% / 11%;
  margin: 10px;
}
#tv::before {
  position: absolute;
  content: '';
  top: 10%;
  bottom: 10%;
  left: -5%;
  right: -5%;
  background: inherit;
  border-radius: 5% / 50%;
}
tv.png

13. Chevron

#chevron {
  position: relative;
  height: 60px;
  width: 200px;
  padding: 12px;
  margin-bottom: 6px;
  box-sizing: border-box;
} 
#chevron::before {
  position: absolute;
  content: '';
  top: 0;
  left: 0;
  height: 100%;
  width: 51%;
  background: red;
  transform: skew(0,6deg);
}
#chevron::after {
  position: absolute;
  content: '';
  top: 0;
  right: 0;
  height: 100%;
  width: 50%;
  background: red;
  transform: skew(0,-6deg);
}
chevron.png

14. 放大镜(Magnifying Glass)

#magnifying-glass {
  width: 0.4em;
  height: 0.4em;
  position: relative;
  font-size: 10em;
  border: 0.1em solid red;
  border-radius: 0.35em;
}
#magnifying-glass::before {
  position: absolute;
  content: '';
  right: -0.25em;
  bottom: -0.1em;
  width: 0.35em;
  height: 0.08em;
  background: red;
  transform: rotate(45deg);
}
magnifying-glass.png

15. 脸书图标(Facebook Icon)

#facebook-icon {
  background: red;
  width: 100px;
  height: 110px;
  border: 15px solid red;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
  border-bottom: 0;
  box-sizing: content-box;
}
#facebook-icon::before {
  position: absolute;
  content: '';
  bottom: -30px;
  right: -37px;
  width: 40px;
  height: 90px;
  border: 20px solid #eee;
  border-radius: 25px;
  background: red;
  box-sizing: content-box;
}
#facebook-icon::after {
  position: absolute;
  content: '';
  top: 50px;
  right: 5px;
  width: 55px;
  height: 20px;
  background: #eee;
  box-sizing: content-box;
}
facebook-icon.png

16. 月亮(Moon)

#moon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  box-shadow: 15px 15px 0 0 red;
}
moon.png

17. 旗帜(Flag)

#flag {
  width: 110px;
  height: 56px;
  background: red;
  padding-top: 15px;
  box-sizing: content-box;
  position: relative;
}
#flag::after {
  position: absolute;
  content: '';
  left: 0;
  bottom: 0;
  width: 0;
  height: 0;
  border-bottom: 13px solid #eeeeee;
  border-left: 55px solid transparent;
  border-right: 55px solid transparent;
}
flag.png

18. 圆锥形(Cone)

#cone {
  width: 0;
  height: 0;
  border-left: 70px solid transparent;
  border-right: 70px solid transparent;
  border-top: 100px solid red;
  border-radius: 50%;
}
cone.png

19. 十字(Cross)

#cross {
  width: 20px;
  height: 100px;
  background: red;
  position: relative;
  margin: 0 40px;
}
#cross::after {
  position: absolute;
  content: '';
  top: 40px;
  left: -40px;
  width: 100px;
  height: 20px;
  background: red;
}
cross.png

20. Base

#base {
  width: 100px;
  height: 55px;
  background: red;
  position: relative;
  margin-left: 20px;
  margin-top: 55px;
  display: inline-block;
}
#base::before {
  position: absolute;
  content: '';
  top: -35px;
  left: 0;
  width: 0;
  height: 0;
  border-bottom: 35px solid red;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
}
base.png

参考链接

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 216,591评论 6 501
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 92,448评论 3 392
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 162,823评论 0 353
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 58,204评论 1 292
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 67,228评论 6 388
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,190评论 1 299
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,078评论 3 418
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 38,923评论 0 274
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,334评论 1 310
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 37,550评论 2 333
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 39,727评论 1 348
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,428评论 5 343
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,022评论 3 326
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 31,672评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,826评论 1 269
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 47,734评论 2 368
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 44,619评论 2 354

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,322评论 0 10
  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,476评论 0 23
  • 敬畏—进入—体验—交给—持续 1,缺啥补啥,怕啥练啥; 2,一切为我所用,所用为团队家; 3,我想变,我要变,我...
    京心达阅读 75评论 0 0
  • 低质量的社交,不如高质量的独处。 在中国的传统文化中,世故人情和人脉总是联系在一起,总是在很多关键时刻化腐朽为神奇...
    诗享者阅读 196评论 0 1
  • class文件是一组以八字节为基础单位的二进制流,class文件格式采用c语言的伪结构来存储数据,它一共有两种数据...
    小小少年Boy阅读 237评论 0 2