Element with position: fixed with a non-positioned sibling - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Fixed Position

Description

Element with position: fixed with a non-positioned sibling

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">
html {<!--  w ww  .j a va 2  s .com-->
   background-color:Chartreuse;
   height:100%;
}

body {
   background-color:yellow;
   height:100%;
}

header {
   position:fixed;
   border:2px solid blue;
}

main {
   margin-top:91px;
   background-color:pink;
}
</style> 
 </head> 
 <body> 
  <header>
    Lorem ipsum dolo 
  </header> 
  <main class="container" id="layout-mainContent"> 
   <div class="row" id="first-row">
     Lorem ipsum d 
   </div> 
  </main>  
 </body>
</html>

Related Tutorials