<!DOCTYPE>
<html>
<head>
<meta chartset="utf-8">
<title>爱心</title>
</head>
<style>
.common{
position:relative;
top:100px;
left:50%;
width:100px;
height:100px;
background-color:red;
transform:rotate(-45deg);
}
.common:before{
content:"";
position:absolute;
top:-50px;
left:0;
width:100px;
height:100px;
border-radius:50%;
background-color:red;
}
.common:after{
content:"";
position:absolute;
top:-0px;
left:50px;
width:100px;
height:100px;
border-radius:50%;
background-color:red;
}
</style>
<body>
<div class="common">
</div>
</body>
</html>
效果图

这篇文章展示了如何使用HTML和CSS创建一个心形元素,通过transform属性实现-45度的旋转,形成一个视觉上的爱心效果。
7576





