2014-09-27 111 views
-1

嘿家伙感谢即将到来的支持我如何设置蓝色来填充整个maininfo div的剩余宽度?我尝试设置宽度:汽车用div宽自动填充剩余空间

<div class="maininfo"> 
    <div class="large">2</div> 
    <div class="smallblock"> 
     <div class="smalltop">3</div> 
     <div class="small">4</div> 
    </div> 
    <div class="smallblock"> 
     <div class="smalltop">5</div> 
     <div class="small">6</div> 
    </div> 
</div> 

.maininfo { 

    width: 600px; 

} 

.large { 
    float: left; 
    height: 95px; 
    background-color: blue; 
    width:auto; 
} 


.smallblock { 
    float: right; 
    height: 90px; 
    margin: 0 0 0 5px; 
    width: 20%; 
} 

.small { 
background-color: red; 
height: 50%; 
width: 100%; 
} 
.smalltop { 
background-color: red; 
height: 50%; 
width: 100%; 
margin-bottom:5px; 
} 

更新了我的JFIDDLE不过现在看来,2号线:http://jsfiddle.net/4ykf5frk/11/

+0

我的意思是**全**,我道歉,并将修复它。 – 2014-09-27 02:09:14

回答

1

如果只是.maininfo,仅仅增加一个 '背景:蓝色;'财产你的风格声明:

.maininfo { 
     background-color: blue; 
     width: 600px; 
    } 

否则,只需添加一个'背景:蓝色'。财产为'身体'元素:

body { 
     background-color: blue; 
    }