2011-09-15 154 views
0

問題是沒有在父div的權利填充和在子div中沒有​​右邊距。我正在使用chrome。溢出:自動 - 沒有權利填充和餘量,鍍鉻

<!doctype html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <title>Template</title> 
</head> 
<body> 
    <div style = "padding: 50px; overflow: auto; width: 300px; height: 300px; background-color: red;"> 
     <div style = "width: 500px; height: 500px; background-color: green;"></div> 
    </div> 
    <hr /> 
    <div style = "overflow: auto; width: 300px; height: 300px; background-color: red;"> 
     <div style = "margin: 50px; width: 500px; height: 500px; background-color: green;"></div> 
    </div> 
</body> 
</html> 

回答

0

我發現填充用的解決方案,遺憾的是它不符合保證金工作:

.container { 
 
    overflow: auto; 
 
    width: 300px; 
 
    height: 150px; 
 
    background-color: red; 
 
} 
 
.padding { 
 
    float: left; 
 
    padding: 50px; 
 
} 
 
.content { 
 
    width: 500px; 
 
    height: 500px; 
 
    background-color: green; 
 
}
<div class="container"> 
 
    <div class="padding"> 
 
    <div class="content"></div> 
 
    </div> 
 
</div>