CSS布局,有个细节求助

图片说明

 <html>
<head>
<style>
.container1{
position:absolute;
left:15%;
right:15%;
width:70%;
height:300px;
background-color:#333333;
margin-top:50px;
padding:0px;
border-width:0px;
border-collapse:collapse;
}

.div_1{
display:inline-block;
position:relative;
margin:0px;
width:100%;
height:50px;
background-color:#555555;
}

.div_2{
display:inline-block;
position:relative;
margin:0px;
width:100%;
height:50px;
background-color:#555555;
}

.container2{
display:inline-block;
width:100%;
height:200px;
float:left;
padding-left:0px;
padding-right:0px;
background-color:#880088;
border-width:0px;
border-collapse:collapse;

}

.c_t_1{
display:inline-block;
width:50%;
height:200px;
background-color:#118822;
margin-left:0px;
margin-right:0px;
border-width:0px;
border-collapse:collapse;
}

.c_t_2{
display:inline-block;
width:49%;
height:200px;
background-color:#ffff22;
margin-left:0px;
margin-right:0px;
border-width:0px;
border-collapse:collapse;
}

</style>
</head>

<body>
<div class="container1">
<div class="div_1"><p>div_1</p></div>
<div class="container2">
    <div class="c_t_1">c_t_1</div>
    <div class="c_t_2">c_t_2</div>
</div>
<div class="div_2"><p>div_2</p></div>
</div>
</body>
</html>

如何让class=c_d_2的DIV充满container2的后50%的宽度, 即使c_d_2的width=50%而不会不会产生布局错乱。我是用的360浏览器打开的。

1个回答

float


        .c_t_2 {
            display: inline-block;
            width: 50%;float:right;/*.................*/
            height: 200px;
            background-color: #ffff22;
            margin-left: 0px;
            margin-right: 0px;
            border-width: 0px;
            border-collapse: collapse;
        }
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!