css3实现爱心图标


使用伪元素实现

使用一个div

 1 <div class="heart-shape"></div> 

css样式设置

1 .heart-shape{position:relative;width:30px;height:30px;background-color:red;border-radius:3px;transform:rotate(45deg);top:50%;left:50%;margin:-15px;}
2 .heart-shape:before{content:'';position:absolute;width:30px;height:30px;background-color:red;border-radius:50%;top:0px;left:-15px;}
3 .heart-shape:after{position:absolute;width:30px;height:30px;content:'';background-color:red;border-radius:50%;left:0px;top:-15px;}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM