首页 生活常识

爱心怎么打出来(常见的爱心代码)

100人浏览   2024-08-06 10:01:03

1. HTML爱心代码:


```

<span >♥</span>

```


2. CSS爱心代码:


```

.heart {

height: 50px;

width: 50px;

background-color: red;

position: relative;

transform: rotate(45deg);

margin-left: 20px;

}

.heart::before, .heart::after {

content: "";

height: 50px;

width: 50px;

background-color: red;

position: absolute;

}

.heart::before {

top: -25px;

border-radius: 25px 25px 0 0;

}

.heart::after {

left: -25px;

border-radius: 25px 0 0 25px;

}

```


3. JavaScript爱心代码:


```

console.log("\

╭┳╮ \n\

│ │ \n\

│ └─╮ \n\

╰───┐ \n\

│ \n\

╰┬╯")

```