CSS3新增盒子模型相关属性

1,box-sizing

总结

 代码演示

<style>
    .box1{
      width: 200px;
      height: 200px;
      background-color: deepskyblue;
      padding: 5px;
      border: 5px solid black;
      margin-bottom: 20px;
    }
    .box2{
      width: 200px;
      height: 200px;
      background-color: gray;
      padding: 5px;
      border: 5px solid black;
      box-sizing: border-box;
    }
  </style>
</head>

运行结果

2,resize

总结

 

代码演示

<style>
    .box1{
      width: 400px;
      height: 400px;
      background-color: skyblue;
      resize: horizontal;
      overflow: hidden;
    }
    .box2{
      width: 600px;
      height: 600px;
      background-color: pink;
    }
  </style>
</head>
<body>
  <div class="box1">
    <div class="box2">123</div>
  </div>
</body>

 运行结果

3,box-shadow

总结

 

 

代码演示

<style>
    .box1{
      width: 400px;
      height: 400px;
      background-color: orange;
      margin: 0 auto;
      margin-top: 100px;
      font-size: 40px;

      /* 写两个值 含义:水平位置 垂直位置 */
      /* box-shadow: 10px 10px; */

      /* 写三个值 含义:水平位置 垂直位置 阴影颜色 */
      /* box-shadow: 10px 10px blue; */

      /* 写三个值 含义:水平位置 垂直位置 模糊程度*/
      /* box-shadow: 10px 10px 10px; */

      /* 写四个值 含义:水平位置 垂直位置 模糊程度 阴影颜色*/
      /* box-shadow: 10px 10px 10px blue; */

      /* 写五个值 含义:水平位置 垂直位置 模糊程度 外延值 阴影颜色*/
      /* box-shadow: 10px 10px 10px 3px blue; */

      /* 写六个值 含义:水平位置 垂直位置 模糊程度 外延值 阴影颜色 内阴影*/
      /* box-shadow: 10px 10px 10px 3px blue inset; */

      position: relative;
      top: 0;
      left: 0;
      transition: .9s linear all;
    }
    .box1:hover{
      box-shadow: 0px 0px 10px black;
      top: -1px;
      left: 0;
    }
  </style>
</head>
<body>
  <div class="box1">hello</div>
</body>

 运行结果

4,opacity不透明度

总结

 

代码演示

 <style>
    .box1{
      width: 200px;
      height: 200px;
      background-color: orange;
      font-size: 40px;
      opacity: .5;
      font-weight: bold;
    }
    .box2{
      position: relative;
    }
    h1{
      position: absolute;
      top: 100px;
      left: 0px;
      width: 400px;
      background-color: black;
      color: white;
      line-height: 100px;
      text-align: center;
      font-size: 40px;
      opacity: .5;

    }
  </style>
</head>
<body>
  <div class="box1">你好啊</div>
  <div class="box2">
    <img src="../images/你瞅啥.jpg" alt="你瞅啥">
    <h1>你瞅啥</h1>
  </div>
</body>

 运行结果

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值