题解 | #圣诞树#

圣诞树

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>
全部评论
对,不一定非得用浮动
点赞 回复 分享
发布于 2022-09-02 15:46 河南

相关推荐

面了100年面试不知...:今年白菜这么多,冬天可以狂吃了
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务