Position absolute inside a container - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Absolute Position

Description

Position absolute inside a container

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dolor sit amet, consectet</title> 
  <style type="text/css">
.foo {<!--  w w  w.  j  a va2s. co m-->
   position:relative;
   width:100px;
   height:100px;
   background:Chartreuse;
}

.bar {
   position:absolute;
   width:31px;
   height:31px;
   top:6px;
   left:6px;
   background:yellow;
}
</style> 
 </head> 
 <body> 
  <div class="foo"> 
   <div class="bar">
     Lorem 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials