题解 | #圣诞树#
圣诞树
https://www.nowcoder.com/practice/4924913926d94e96a70bbf2a50847852
代码如下:
1.先把三角形弄出来 只需要将除底边框的颜色都设置透明色
2.通过浮动让小三角形脱离文档流 接着再用左外边距调居中即可
<!DOCTYPE html>
<html><head>
<meta charset=utf-8>
<style type="text/css">
.topbranch {
width: 0px;
height: 0px;
/*
* TODO: 上枝叶效果
*/
border-width:100px;
border-style:solid;border-color:transparent transparent green transparent;
float:left;
margin-left:100px;
}
.middleBranch {
width: 0px;
height: 0px;
/*
* TODO: 中枝叶效果
*/
border-width:200px;
border-style:solid;
border-color:transparent transparent green transparent;
}
.base {
/*
* TODO: 树干效果
*/
width:70px;
height:200px;
background-color:gray;
margin-left:165px;
}
</style>
</head>
<body>
<section class="topbranch"></section>
<section class="middleBranch"></section>
<section class="base"></section>
</body>
</html>
#社畜简单的快乐#