2011-12-20 135 views
1

HTML代碼CSS邊緣不responsed

<div id="page"> 
    <div id="container2"> 
     <div id="container1"> 
     <div id="mainarea"> 
      <?php include mainarea_constractor.php";?> 
     </div> 
     <div id="sidebar"> 
     //content_of_sidebar_goes_here 
     </div> 
     </div> 
    </div> 
</div> 

CSS代碼:

#page{ 
    margin:auto; 
    width:990px; 
    padding:0 10px; 
    padding-top:5px; 
    padding-bottom:5px; 
    background: url(/template/img/main/containt_bg.png) center center repeat-y; 
    overflow: hidden; 
} 

#container2 { 
    clear:left; 
    float:left; 
    width:990px; 
    overflow:hidden; 
} 
#container1 { 
    float:left; 
    width:995px; 
    position:relative; 
    right:340px; 
    border-right:1px double #c1c0a8; 
    text-align:justify; 
} 
#mainarea { 
    float:left; 
    width:650px; 
    left:340px; 
    position:relative; 
    overflow:hidden; 
    padding-right:5px; 
} 
#sidebar { 
    float:left; 
    width:330px; 
    position:relative; 
    left:345px; 
    overflow:hidden; 
} 

的問題是,當我把一個div成MAINAREA,我無法設置餘量或填充選項 例如:

<div id="mainarea"> 
    <div style="margin-left:15px;" id="inner_div"> 
     Content_for_inner_div 
    </div> 
</div> 

任何幫助? 當我設置飄進#inner_div的作品,但我不想飄進我的div ... 我不希望如果可能的話(頁,container2的,container1)

+0

我沒有看到這個問題:http://jsfiddle.net/GahtA/ – ptriek 2011-12-20 14:13:03

+0

@ptriek所以這個問題是在這裏http://jsfiddle.net/GahtA/1/ .lesson_more content - 提示:點擊標題 – 2011-12-20 14:20:06

+1

@ user726730冒着被貼上喜劇演員的危險,這對我來說都是希臘文。你遇到的問題究竟在哪裏? – Blazemonger 2011-12-20 14:34:36

回答

0

如果我理解改變我的通用模板你的問題正確,我認爲只有這樣,才能在一個div是裏面像你想是使用

float:left; 
margin-left:15px; 

它不應該打破你的風格,如果你漂浮只要留給內部的div使用的利潤率並不比大持有它的外部div。

檢查此鏈接了http://jsfiddle.net/vabfs/