Position Div inside div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Position

Description

Position Div inside div

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">
.jumbotron {<!--from   w  w  w.  j av  a  2  s . c o m-->
   padding:31px 16px;
   margin-bottom:31px;
   color:Chartreuse;
   overflow:hidden;
   background-size:cover;
   background-position:center;
   background-repeat:no-repeat;
   background:yellow;
   border-radius:4px;
   box-shadow:0 2px 6px blue;
   font-family:Helvetica Neue, Helvetica, Arial, sans-serif;
   z-index:3;
   position:absolute;
   top:0;
   left:0;
}

.background-image {
   padding:31px 16px;
   margin-bottom:31px;
   color:pink;
   overflow:hidden;
   background-size:cover;
   background-position:center;
   background-repeat:no-repeat;
   background-image:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   background-size:cover;
   display:block;
   filter:blur(6px);
   -webkit-filter:blur(6px);
   height:801px;
   left:0;
   right:0;
   z-index:2;
   top:0;
   position:absolute;
}

.hero-spacer {
   position:relative;
}
</style> 
 </head> 
 <body> 
  <div class="hero-spacer"> 
   <div class="background-image"></div> 
   <header class="jumbotron hero-spacer"> 
    <h1>Lorem i</h1> 
    <p>Lore</p> 
   </header> 
  </div>  
 </body>
</html>

Related Tutorials