使用CSS绘制桃心

CSS3扩展了html和css的功能,它允许我们实现更复杂的样式。下面让我们看看,怎么使用css创建桃心形状

桃心可以通过两个基本的形状组成,一个正方形和两个圆形,如下图:

<html>
  <head>
    <title>绘制桃心</title>
    <meta charset="UTF-8">
  </head>

  <style>
    .my_true_heart{
      position: fixed;
      top: 30%;
      left: 30%;
      width: 200px;
      height: 200px;
      -webkit-transform: rotate(45deg);
      -moz-transform: rotate(45deg);
      -ms-transform: rotate(45deg);
      -o-transform: rotate(45deg);
      transform: rotate(45deg);
      background-color: rgba(255,15,24, 1);
    }
    .my_true_heart:before{
      position: absolute;
      bottom: 0px;
      left: -100px;
      width: 200px;
      height: 200px;
      content: '';
      -webkit-border-radius: 50%;
      -moz-border-radius: 50%;
      -o-border-radius: 50%;
      border-radius: 50%;
      background-color: rgba(255,15,24, 1);
    }
    .my_true_heart:before{
      bottom: 0px;
      left: -100px;
    }
    .my_true_heart:after{
      position: absolute;
      width: 200px;
      height: 200px;
      content: '';
      -webkit-border-radius: 50%;
      -moz-border-radius: 50%;
      -o-border-radius: 50%;
      border-radius: 50%;
      background-color: rgba(255,15,24, 1);
    }
    .my_true_heart:after{
      top: -100px;
      right: 0px;
    }
   </style>

  <body>
    <div class="my_true_heart"></div>
  </body>

</html>
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • CSS参考手册 一、初识CSS3 1.1 CSS是什么 CSS3在CSS2.1的基础上增加了很多强大的新功能。目前...
    没汁帅阅读 3,804评论 1 13
  • 1、属性选择器:id选择器 # 通过id 来选择类名选择器 . 通过类名来选择属性选择器 ...
    Yuann阅读 1,671评论 0 7
  • CSS基础 本文包括CSS基础知识选择器(重要!!!)继承、特殊性、层叠、重要性CSS格式化排版单位和值盒模型浮动...
    廖少少阅读 3,247评论 0 40
  • 选择qi:是表达式 标签选择器 类选择器 属性选择器 继承属性: color,font,text-align,li...
    love2013阅读 2,350评论 0 11
  • 因为近期项目没有压力,主要工作就是一些涉及功能增删相关的界面的小工作,修修补补,搞个图标之类,设计师小伙伴们都懂的...
    泱泱悲秋阅读 5,362评论 1 27