我很驚訝:有大量的帖子詢問高度情況100%,但包含子元素中的* 頁邊距的帖子不會產生任何可行的響應。CSS3邊距和100%寬度/高度聲明
當然這很常見,不是嗎?我正在掙扎,導致子元素溢出。請參閱下面的fiddle。
我的CSS像這樣:
html, body {height:100%} // definitely doing that one for 100% height issues
div {
box-sizing:border-box; // I like my box model consistent, need only webkit
}
#outer {
border:1px solid #f00;
position:absolute; // this is a requirement
top:40px;
left:12px;
width:300px;
}
#inner {
position:relative; // I'm really hoping to avoid absolute
border:1px solid #0f0;
margin:10px 20px;
height:100%;
width:100%;
}
小提琴:http://jsfiddle.net/3aPzq/
這種珍貴的問題是:如何讓子元素(綠色邊界),而正常是其母公司的內聯,與正確的利潤率?
你的意思是像http://jsfiddle.net/3aPzq/2/? –
是的,就像那樣。 – tim