Prohibiting an item's margin to overflow its container - HTML CSS CSS Property

HTML CSS examples for CSS Property:overflow

Description

Prohibiting an item's margin to overflow its container

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">
.one {<!--from w ww  .ja v  a 2 s .co  m-->
   background:red;
}

.one:before {
   content:"";
   display:block;
   height:2px;
   margin-bottom:-2px;
}

.two {
   background:blue;
   height:51px;
   width:51px;
   margin-top:31px;
}
</style> 
 </head> 
 <body> 
  <div class="one"> 
   <div class="two"></div> 
  </div>Lorem i 
  <div class="one">
    Lorem ip 
  </div>  
 </body>
</html>

Related Tutorials