首页 >

css3做圣诞树 |css按钮之间的间距

css 数字 美化,css像素如何表示,css更新到几了,动态改变img的css,css渐变从透明到纯白,div css下拉菜单竖向,css按钮之间的间距css3做圣诞树 |css按钮之间的间距
.tree {
position: relative;
width: 150px;
height: 200px;
}
.tree:before {
content: "";
position: absolute;
bottom: 0;
left: 50%;
width: 0;
height: 0;
border-left: 75px solid transparent;
border-right: 75px solid transparent;
border-bottom: 100px solid green;
transform: translateX(-50%);
}
.tree:after {
content: "";
position: absolute;
bottom: 20px;
left: 50%;
width: 0;
height: 0;
border-left: 50px solid transparent;
border-right: 50px solid transparent;
border-top: 80px solid green;
transform: translateX(-50%);
}
.tree__ornament {
position: absolute;
width: 10px;
height: 10px;
border-radius: 50%;
background-color: red;
animation: move 2s ease-in-out infinite;
}
@keyframes move {
0% {
transform: translateY(0);
}
50% {
transform: translateY(-10px);
}
100% {
transform: translateY(0);
}
}

首先,大家需要一个容器div,给它一个class名为tree。然后利用:before和:after伪元素来画出树干和树叶,设置宽高、颜色等属性即可。在树叶上添加小装饰,通过animation属性控制运动轨迹,做出有趣的效果。

这样,一个简单的CSS3圣诞树就完成啦!


css3做圣诞树 |css按钮之间的间距
  • html的标签里代表加粗的标签是什么? |java word2007转html
  • html的标签里代表加粗的标签是什么? |java word2007转html | html的标签里代表加粗的标签是什么? |java word2007转html ...

    css3做圣诞树 |css按钮之间的间距
  • css三级菜单内容过多 |css3中矩阵变换
  • css三级菜单内容过多 |css3中矩阵变换 | css三级菜单内容过多 |css3中矩阵变换 ...

    css3做圣诞树 |css按钮之间的间距
  • css 针动画 |css3 flex order
  • css 针动画 |css3 flex order | css 针动画 |css3 flex order ...