方法一:浮动

     <div class="container">
          <div class="content">hello</div>
          <div class="left"></div>
          <div class="right"></div>  
     </div>
 
     <style>
          .left{

               float:left;
               width: 200px;
               height: 300px;
               background: red;
          }
          .right{
               float: right;
               width: 200px;
               height: 300px;
               background: green;
          }
          .content{
               width: 100%;
               height: 300px;
               background: blue;
          }

     </style>
 
方法二:定位
       .left{
               width: 200px;
               height: 300px;
               background: red;
               position: absolute;
               left: 0;
               top: 0;

          }
          .right{
               width: 200px;
               height: 300px;
               background: green;
               position: absolute;
               right: 0;
               top: 0;

          }
          .content{
               width: 100%;
               height: 300px;
               background: blue;
               margin:0 200px;
          }
          .container{
               position:relative;
          }
 
方法三:display:box
          .left{
               width: 200px;
               height: 300px;
               background: red;
          }
          .right{
               width:200px;
               height: 300px;
               background: green;
          }
          .content{
               box-flex:1
               height: 300px;
               background: blue;
          }
          .container{
               display:box;
          }
 
 
 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-22
  • 2022-01-06
  • 2022-02-09
  • 2022-12-23
  • 2022-02-09
  • 2021-10-12
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案