Sidebar layout fix
by wamosjk
HTML
<header>
<div class="head">
Your Header
</div>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Computer Science</a></li>
<li><a href="#">Civil</a></li>
<li><a href="#">Mechanical</a></li>
</ul>
</nav>
</header>
<div class="main-wrapper">
<aside>
Your Side Column
</aside>
<main>
Your Main Content
</main>
</div><!-- end main wrapper -->
<footer>
Your Footer
</footer>
CSS
* {
box-sizing: border-box;
}
body{
padding:0;
margin:0;
padding-top:130px;
}
header{
position:fixed;
top:0;
left:0;
width:100%;
}
.head{
height:100px;
background:#0d4091;
}
nav{
background:#fff;
border-bottom:1px solid #999;
}
nav ul{
list-style-type: none;
padding:0;
margin:0;
display:flex;
align-items:center;
height:30px;
}
nav ul li{
text-align:center;
flex:1;
padding:5px;
}
nav ul li a{
text-decoration:none;
color:#555;
}
/* This wrapps your main content and sidebar. */
.main-wrapper{
display:flex;
}
aside{
background:#0d4091;
width:300px;
}
main{
padding:15px;
flex:1;
background:green;
/*Height and green background set to show you the sidebar will follow the main content down the page*/
height:200vh;
}
footer{
background:#000;
color:#fff;
padding:15px;
}
@media screen and (max-width:767px){
body{
padding-top:0;
}
header{
position:relative;
}
nav ul{
height:auto;
flex-direction:column;
}
nav ul li{
border-bottom:1px solid #999;
width:100%;
}
.main-wrapper{
flex-direction:column;
}
aside, main{
width:100%;
}
aside{
/*order set at small screens so content is below main if you want it to be before then delete this */
order: 2;
}
.table{
flex-direction:column;
}
.table-col{
width:100%;
margin-bottom:15px;
}
}