Maison  >  Article  >  interface Web  >  CSS左右固定,中间填满布局_html/css_WEB-ITnose

CSS左右固定,中间填满布局_html/css_WEB-ITnose

WBOY
WBOYoriginal
2016-06-24 11:36:511279parcourir

先上个高清无码图:


源码:

<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"><head>    <meta charset="utf-8" />    <title></title>    <link href="reset.css" rel="stylesheet" /> <!--重置默认样式,你可以把这句注释掉-->    <style>        div {            line-height:60px; /*让字体垂直居中*/        }        div.box {            width: 100%;            height: 60px;            background: yellow;            text-align: center; /*让字体水平居中*/            color: white;        }            div.box div.left, div.right {                width: 60px;                height: 60px;                background: red;                            }            div.box div.left {                float: left;            }            div.box div.right {                float: right;            }            div.box div.center {                height: 60px;                background: green;                           }    </style></head><body>    <div class="box">        <div class="left">左固定</div>        <div class="right">右固定</div>        <div class="center">中间填满</div>          </div></body></html>



Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn