Creating a fixed width sidebar with a responsive container for content next to it in CSS - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Responsive Layout

Description

Creating a fixed width sidebar with a responsive container for content next to it in CSS

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.sidebar {<!-- w w  w  . jav a 2  s .  com-->
   width:201px;
   position:fixed;
   height:100%;
   background-color:Chartreuse;
}

.parent {
   position:relative;
   width:100%;
   height:auto;
   padding-left:201px;
   border:3px solid yellow;
}

#kid {
   width:76%;
   margin:0 auto;
   border:3px solid blue;
}
</style> 
 </head> 
 <body> 
  <div class="sidebar"> 
  </div> 
  <div class="parent"> 
   <div id="kid">
     Lorem ipsum dolor sit amet, consectetur adipis 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials