Position:fixed and width:inherit with percentage parent - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Fixed Position

Description

Position:fixed and width:inherit with percentage parent

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">
#outer {<!-- ww w .  j av  a  2  s. c  o  m-->
   width:301px;
   border:2px solid Chartreuse;
}

#container {
   width:91%;
   border:2px solid yellow;
   height:301px;
}

#fixed {
   position:relative;
   width:100%;
   border:2px solid blue;
}
</style> 
 </head> 
 <body> 
  <div id="outer"> 
   <div id="container"> 
    <div id="fixed">
      Lorem ipsu 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials