天天看點

Nearth===>WEB前端--第4課/html5/盒子模型+定位

盒子模型+定位:div的使用,postion:fixed;定位的使用;

盒子模型的嵌套:div中div;

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title></title>
    <style type="text/css">
      *{
        margin:0px;
        padding:0px;
      }
      #div1{
        width:200px;
        height:200px;
        border:2px solid green;
      }
      #div2{
          width:200px;
        height:200px;
        border:2px solid red; 
      }
      #div3{
          width:200px;
        height:200px;
        border:2px solid yellow;
        position:relative;
        margin-top:40px;
      }
      #div4{
        width:50px;
        height:50px;
        border:2px solid blue;
        background-color:black;
      }
      #div5{
        width:200px;
        height:200px;
        border:2px solid orange;
              position:fixed;
        right:50px;
        top:50px;
      }
    </style>
  </head>
  <body>
    <div id="div1">
      <div id="div4">
        div4
      </div>
    </div>
    <div id="div2">
      div2
    </div>
    <div id="div3">
      div3
    </div>
    
    <div id="div5">
      div5
    </div>
  </body>
</html>      

來和小妲己一起學習鴨哒·······························