题解 | #圣诞树#
圣诞树
http://www.nowcoder.com/practice/4924913926d94e96a70bbf2a50847852
通过代码css可实现效果,从个人而言css的灵活性较强,效果比测试用例更有用。
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<style type="text/css">
.topbranch {
width: 0px;
height: 0px;
border: 100px solid transparent;
border-bottom-color: green;
margin-left: 100px;
/*
* TODO: 上枝叶效果
*/
}
.middleBranch {
width: 0px;
height: 0px;
border: 200px solid transparent;
border-bottom-color: green;
margin-top: -200px
/*
* TODO: 中枝叶效果
*/
}
.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>
