当前位置: 移动技术网 > IT编程>网页制作>CSS > 三列浮动中间宽度自适应

三列浮动中间宽度自适应

2020年01月14日  | 移动技术网IT编程  | 我要评论
二个固定定位,用margin 把左边和右边都让出来。
 
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <title>三列浮动中间宽度自适应</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #left{
            border :1px solid red;
            width: 200px;
          /* height: 200px; */
            height: 100%;
            position: absolute;
            top :0px;
            left :0px;
        }
        #right{
            border :1px solid green;
            width: 200px;
    /* height: 200px; */
    height: 100%;
            position: absolute;
            top :0px;
            right :0px;
          
        }
        #center{
            background-color: #fcc;
            border:1px solid  black;
            /* height: 200px; */
            height: 100%;
            margin-left:205px;
            margin-right:205px;

 

            
        }
        .box{
            height:   500px;
            border:1px solid  green;
            position: relative;

 

        }
    
    
    </style>
</head>
<body>
    <div class="box">
        <div id="left"></div>
        <div id="center"></div>
        <div id="right"></div>

 

    </div>
 
</body>
</html>

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网