标准模式和混杂模式下的盒模型

相关内容参考:
http://www.cnblogs.com/cchyao/archive/2010/07/12/1775846.html
http://www.runoob.com/css/css-boxmodel.html
总结:

IE盒子模型特点:
width=(border+padding+content)的宽度
height=(border+padding+content)的高度

标准盒模型:
width=content的宽度
height=content的高度

主要是针对标准模式下的盒模型进行学习
标准模式下设置元素的width实际上是对盒模型的content的宽度进行设置,而不包括border值和padding值

<!DOCTYPE html>
<html lang="en">
<head>
  <title>pullpage插件实现全屏效果</title>
  <meta charset="utf-8" />

  <link rel="stylesheet" href="css/animate.min.css" />
  <link rel="stylesheet" href="css/jquery.fullPage.css">
</head>
<style type="text/css">
    .spe{
      width:200px;
      height:200px;
      line-height:200px;
      background-color: pink;
      margin-bottom: 20px;
      text-align: center;
    }
    .special1{
          padding:20px;
          border:5px solid red;
    }
    .special2{
          padding:20px;
          border:5px solid red;
          box-sizing:border-box;
    }
</style>
<body>
    <div class="spe">没有border和padding</div>
    <div class="spe special1">有border和padding</div>
    <div class="spe special2">border-box</div>
</body>
</html>

这里写图片描述

border-box的属性
这里写图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值