用div画一个圣诞树

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>圣诞树</title>
    <style>
           #container{
               width: 100px;
               height: 300px;
               background: blue;
           }
           #aa{
               width:0px;
               height: 0px;
               margin-left: 25px;
               margin-right: 25px; 
               border-top: 40px solid transparent;
               border-left: 25px solid transparent;
               border-right: 25px solid transparent;
               border-bottom: 50px solid red;
           }
           #bb{
               width: 0px;
               height: 0px;
               border-top: 0px solid transparent;
               border-bottom: 80px solid red;
               border-left: 40px solid transparent;
               border-right: 40px solid transparent;
               margin-left: 10px;
               margin-right: 10px;
           }
           #cc{
               width: 26px;
               height: 100px;
               margin-left: 37px;
               margin-right: 74px;
                     background: brown;
                     margin-bottom: 50px;
           }
    </style>
</head>
<body>
    <div id="container">
        <div id="aa"></div>
        <div id="bb"></div>
        <div id="cc"></div>
    </div>
</body>
</html>

div id与div class的区别:

1、使用区别
id具有唯一性,在一个网页中同一个命名只能使用一次;
class命名的类可以在一个网页中使用无数次。

2、css中区别
id在css代码中是以“#”井号符号开头命名的类
class在css代码中是以“.”小写句号符号命名开头的类

转载于:https://www.cnblogs.com/lq13035130506/p/10458394.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值