css实现猪头
时间: 2023-08-05 11:20:49 浏览: 46
好的,以下是我用 CSS 实现的猪头:
```html
<div class="pig-head">
<div class="nose"></div>
<div class="eye"></div>
<div class="ear"></div>
<div class="ear"></div>
</div>
```
```css
.pig-head {
position: relative;
width: 100px;
height: 100px;
border-radius: 50%;
background-color: #fdd7e4;
}
.nose {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 20px;
height: 20px;
border-radius: 50%;
background-color: #000;
}
.eye {
position: absolute;
top: 35%;
left: 30%;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #000;
}
.eye:last-child {
left: 60%;
}
.ear {
position: absolute;
top: 25%;
width: 20px;
height: 40px;
border-radius: 50%;
background-color: #fdd7e4;
transform: rotate(-30deg);
}
.ear:last-child {
left: 60%;
transform: rotate(30deg);
}
```
希望您喜欢我的作品!