force DIV inside an LI with overflow hidden styling - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Element

Description

force DIV inside an LI with overflow hidden styling

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">
.box {<!-- w w  w .  j av  a2  s . c  om-->
   float:left;
   width:100px;
   height:100px;
   border:2px solid Chartreuse;
   margin:11px;
   text-align:center;
   vertical-align:middle;
   position:relative;
}

.box-inner {
   width:100%;
   height:100%;
   overflow:hidden;
}

.badge {
   position:absolute;
   width:100px;
   height:100px;
   border:2px solid yellow;
   text-align:center;
   vertical-align:middle;
   bottom:-56px;
}

.container {
   border:2px solid blue;
   width:501px;
   height:121px;
   margin:21px auto 0px;
   background-color:pink;
}
</style> 
 </head> 
 <body> 
  <div class="container"> 
   <li class="box" style="background-color: red;"> 
    <div class="box-inner">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam pha 
    </div> </li> 
   <li class="box" style="background-color: green;"> 
    <div class="box-inner">
      Lorem i 
    </div> </li> 
   <li class="box" style="background-color: blue;"> 
    <div class="box-inner">
      Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam erat volutpat. Vestibulum tortor neque, ornare vitae tempor hendrerit, luctus at neque. Phasellus sed quam phar 
    </div> 
    <div style="background-color: #ff0;" class="badge">
      Lorem i 
    </div> </li> 
  </div>  
 </body>
</html>

Related Tutorials