Overflow only certain elements - HTML CSS CSS Property

HTML CSS examples for CSS Property:overflow

Description

Overflow only certain elements

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">
* {<!--from  w  w  w .  j  a  va  2  s .  c o  m-->
   box-sizing:border-box;
}

.red {
   position:relative;
   border:4px solid Chartreuse;
   width:301px;
   height:301px;
}

.red:after {
   content:"";
   position:absolute;
   left:0;
   right:0;
   height:71px;
   background:yellow;
   bottom:-71px;
   z-index:-2;
}

.blue,.green {
   position:absolute;
   width:71px;
   height:71px;
   bottom:-41px;
}

.blue {
   background-color:blue;
   z-index:2;
   left:41px;
}

.green {
   background-color:pink;
   z-index:-2;
   right:41px;
}
</style> 
 </head> 
 <body> 
  <div class="red"> 
   <div class="blue"></div> 
   <div class="green"></div> 
  </div>  
 </body>
</html>

Related Tutorials