使用css画一颗苹果树,叶子是蓝色的,苹果是黄色的
时间: 2023-05-19 21:03:07 浏览: 68
好的,以下是使用 CSS 画一颗苹果树,叶子是蓝色的,苹果是黄色的代码:
HTML 代码:
```
<div class="tree">
<div class="trunk"></div>
<div class="leaves"></div>
<div class="apple"></div>
</div>
```
CSS 代码:
```
.tree {
position: relative;
width: 100px;
height: 150px;
}
.trunk {
position: absolute;
bottom: 0;
left: 50%;
width: 10px;
height: 100px;
margin-left: -5px;
background-color: brown;
}
.leaves {
position: absolute;
top: 0;
left: 50%;
width: 80px;
height: 80px;
margin-left: -40px;
border-radius: 50%;
background-color: blue;
}
.apple {
position: absolute;
top: 80px;
left: 50%;
width: 20px;
height: 20px;
margin-left: -10px;
border-radius: 50%;
background-color: yellow;
}
```
希望这个代码能够帮到你!