题解 | #圣诞树#
圣诞树
http://www.nowcoder.com/practice/4924913926d94e96a70bbf2a50847852
利用树顶的浮动,使他脱离文档流,达到树中和树顶的靠拢;
设置实体边框,除下边框其他均设置透明做成下三角形;
<style type="text/css">
.topbranch {
width: 0px;
height: 0px;
border:100px solid;
border-color: transparent transparent green;
float:left;
margin-left:100px;
/*
* TODO: 上枝叶效果
*/
}
.middleBranch {
width: 0px;
height: 0px;
border:200px solid;
border-color: transparent transparent green;
/*
* TODO: 中枝叶效果
*/
}
.base {
height:200px;
width:70px;
background:gray;
margin-left:165px;
/*
* TODO: 树干效果
*/
}
</style>
.topbranch {
width: 0px;
height: 0px;
border:100px solid;
border-color: transparent transparent green;
float:left;
margin-left:100px;
/*
* TODO: 上枝叶效果
*/
}
.middleBranch {
width: 0px;
height: 0px;
border:200px solid;
border-color: transparent transparent green;
/*
* TODO: 中枝叶效果
*/
}
.base {
height:200px;
width:70px;
background:gray;
margin-left:165px;
/*
* TODO: 树干效果
*/
}
</style>