Possible to fix an element to top inside an absolute positioned div - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Absolute Position

Description

Possible to fix an element to top inside an absolute positioned 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">
.A {<!--from   w  w  w . ja v  a  2 s. c  o m-->
   position:relative;
   top:21px;
   border:2px solid Chartreuse;
}

.B {
   position:absolute;
   top:21px;
   left:21px;
   width:100px;
   height:100px;
   background-color:yellow;
}

.C {
   position:absolute;
   top:0;
   right:0;
}
</style> 
 </head> 
 <body> 
  <div class="A"> 
   <div class="B"> 
    <div class="C">
      Lor 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials