我使用Flexboxes以下HTML/CSS代碼:對齊Flexbox的不同,當顯示尺寸變化
*{
font-family:Arial;
}
html,
body {
height: 100%;
margin: 0
}
.flexbox {
display: flex;
flex-direction: column;
flex-wrap: nowrap;
height: 100%;
width: 100%
}
.flexbox .header{
background: green;
border:solid;
font-size: 30;
font-weight: bold;
padding-left: 5;
}
.flexbox .main {
flex: 1;
background: red;
position: relative
}
.flexbox-row {
display: flex;
position:absolute;
height: 100%;
width: 100%
}
.flexbox-row .links
{
background: yellow;
width:15%;
height:100%;
}
.flexbox-row .second {
flex: 1;
background: blue;
height:100%;
}
nav.sidenav {
margin:0;
background-color: white;
overflow: auto;
height:100%;
}
nav.sidenav a {
display: block;
color: black;
text-decoration: none;
padding: 8px;
text-align: center;
}
nav.sidenav a.active {
background-color: blue;
color: white;
}
nav.sidenav a:hover {
background-color: #555;
color: white;
text-decoration: underline;
}
@media screen and (max-width: 1000px) {
nav.sidenav {
width: 100%;
height: auto;
position: relative;
border-top:none;
border-bottom:solid;
margin-top:0;
}
nav.sidenav a {
float: left;
padding: 8px;
}
.flexbox {
display: flex;
flex-direction: column;
flex-wrap: initial;
width: 100%
}
.flexbox-row .links{
width:100%;
}
.flexbox-row .second {
background: blue;
}
}
<div class="flexbox">
<div class="header">HeaderHeaderHeaderHeaderHeaderHeade</div>
<div class="main">
<div class="flexbox-row">
<div class="links">
navbar
</div>
<div class="second"> content</div>
</div>
</div>
所以標題保持不變,然後是導航欄和內容。填充瀏覽器高度。IAM新的CSS和不太瞭解如何正確使用柔性盒。
讓我知道,如果我的回答是有益的,可以接受和/或upvoted ...或者它只是沒有工作? – LGSon
因爲我沒有得到任何確認我的回答有用或有幫助,所以我刪除了它。 – LGSon
對不起,最後幾天無法捕捉任何互聯網。 希望能夠閱讀您的答案。 – Kitumijasi