prevent padded child element to overflow its parent - HTML CSS CSS Property

HTML CSS examples for CSS Property:overflow

Description

prevent padded child element to overflow its parent

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">
.outside {<!-- w w w.j  a  v a  2 s . c om-->
   width:100px;
   height:100px;
   background:red;
}

.inside {
   width:100%;
   padding:11px;
   background:blue;
   border:none;
   -webkit-box-sizing:border-box;
   -moz-box-sizing:border-box;
   box-sizing:border-box;
}
</style> 
 </head> 
 <body> 
  <div class="outside"> 
   <input class="inside"> 
  </div>  
 </body>
</html>

Related Tutorials