2013-06-19 186 views
1

如何並排放置2個div,一個div的寬度爲75%,另一個寬度爲25%。另一個div爲margin:0 auto;在它的頂部,以使頁面中心的內容寬度爲:986px;流體和固定佈局

PLS看下面的代碼

#bodywrapper 
{ 
margin:0 auto; 
} 
#green-portion 
{ 
background:url('images/green_portion.png') no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
    width:75%; 
    position:absolute; 
    top:30%; 
    bottom:0; 
    left:0; 
    right:0; 
    overflow:hidden; 
    z-index:-1; 
    display:none; 
} 
#blue-portion 
{ 
    width:25%; 
    background-color:#051f3b; 
    height:400px; 
    position:absolute; 
    top:30%; 
    bottom:0; 
    left:75%; 
    right:0; 
    overflow:hidden; 
    z-index:99999; 


    } 
<div id="bodywrapper"> 



<div id="green-portion"> 
</div> 

<div id="blue-portion"> 
</div> 

</div> 
+0

當我低的分辨率,在申報單到處移動 – user2451541

回答

1

的CSS;

#blue-portion { 
    float: right; 
} 
5
#bodywrapper { 
margin:0 auto; 
} 
#green-portion { 
    background:#00CC00; 
    width:75%; 
    height:400px;  
    top:30%; 
    float:left; 
} 
#blue-portion { 
    width:25%; 
    background-color:#051f3b; 
    height:400px; 
    top:30%; 
    float:right; 
} 
<div id="bodywrapper"> 
    <div id="green-portion"></div> 
    <div id="blue-portion"></div> 
</div>