如何让三个DIV块,两边宽度固定, 中间宽度自适应?_

慕莱坞3734739
浏览 2432回答 2
2回答

最后一次改名字

<!DOCTYPE html> <html> <head>     <meta charset="UTF-8" />     <title>Document</title>     <style type="text/css">         *{             margin:0;             padding:0;         }         html,body{             height:100%;         }         .box{             padding:0 200px;             height:100%;             position:relative;         }         .left,.right,.mid{             height:100%;         }         .left,.right{             top:0;             width:200px;         }         .left{             position:absolute;             left:0;             background:#fcf;         }         .right{             position:absolute;             right:0;             background:#f40;         }         .mid{             width:100%;             background:blue;         }     </style> </head> <body>     <div  class="box">         <div class="left"></div>         <div class="mid"></div>         <div  class="right"></div>     </div> </body> </html>

KJinn

如果要简单的就去了解下flex弹性合资布局。慕课网就有。如果要兼容性前强的就DIV1右浮动,宽度10%;DIV2左浮动,宽度10%;DIV3宽度100%;padding:0 10%;
打开App,查看更多内容
随时随地看视频慕课网APP