写一个爱心的html代码
时间: 2023-10-26 16:35:32 浏览: 26
以下是一个简单的爱心 HTML 代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>爱心</title>
<style>
body {
background-color: #f2f2f2;
}
.heart {
position: relative;
width: 100px;
height: 90px;
transform: rotate(-45deg);
margin: 50px auto;
background-color: #ff6b6b;
box-shadow: inset -10px 0 10px rgba(0, 0, 0, 0.1);
border-radius: 50px 50px 0 0;
}
.heart::before,
.heart::after {
content: "";
position: absolute;
background-color: #ff6b6b;
border-radius: 50px 50px 0 0;
}
.heart::before {
width: 100px;
height: 100px;
top: -50px;
left: 0;
}
.heart::after {
width: 100px;
height: 100px;
top: 0;
left: 50px;
}
</style>
</head>
<body>
<div class="heart"></div>
</body>
</html>
```
这个代码将会画出一个红色的爱心,效果如下:
![heart](https://i.imgur.com/9M7hL3Q.png)