html响应式五栏布局,HTML – 响应式2列CSS布局,包括固定宽度的侧边栏?
在任何地方找不到解決方案(我猜這一定是一個(gè)非常常見(jiàn)的問(wèn)題).
我正在創(chuàng)建一個(gè)帶側(cè)邊欄的響應(yīng)式設(shè)計(jì),其中側(cè)邊欄需要具有200px的固定寬度并且具有未知高度.我怎樣才能使主要內(nèi)容區(qū)占據(jù)所有剩余的寬度,而不會(huì)有任何不當(dāng)行為.
最接近我的是以下內(nèi)容,但問(wèn)題在于側(cè)邊欄可以與頁(yè)腳重疊.任何人都可以建議修復(fù)我的代碼,或與我分享一些有效的代碼?
* {
padding: 0;
margin: 0;
outline: 0;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
body {
background: orange;
}
#container {
max-width: 1000px;
min-width: 768px;
margin: 0 auto;
background: yellow;
position: relative;
height: 100%;
}
#header {
background: purple;
color: white;
text-align: center;
padding: 10px;
}
#main {
position: relative;
}
aside {
background: blue;
width: 200px;
color: white;
position: absolute;
top: 0;
/* change this to "right: 0;" if you want the aside on the right. Also, change the "margin-left" code, below. */
left: 0;
padding-top: 20px;
padding-bottom: 20px;
padding-left: 10px; /* If you change this value, remember to change the margin-left value of #primary */
padding-right: 10px; /* ditto */
}
#primary {
background: red;
/* change this to margin-right if you want the aside on the right. Also change the "left" code, above. */
margin-left: 220px; /* aside_width + aside_left_padding + aside_right_padding = 200px + 10px + 10px */
padding: 1em; /* whatever */
}
#footer {
background: green;
color: white;
padding: 10px;
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
LAYOUT TEST #2
THIS IS THE MAIN CONTENT ** THIS IS THE MAIN CONTENT ** THIS IS THE MAIN CONTENT
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
sub heading
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
sub heading
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
navigation (left)
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
LAYOUT TEST #2
總結(jié)
以上是生活随笔為你收集整理的html响应式五栏布局,HTML – 响应式2列CSS布局,包括固定宽度的侧边栏?的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 外贸常用术语_外贸中常用的会计术语及付款
- 下一篇: r语言怎么保存代码_R代码忘记保存,系统