properly align list items vertically - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:UL Alignment

Description

properly align list items vertically

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">
#example>ul {
   padding:0;
}

.item {<!--  w  w w  .  j a v a  2  s  .co m-->
   width:100%;
   background:Chartreuse;
   padding:21px;
   box-sizing:border-box;
   margin:21px 0;
   overflow:hidden;
}

.item h2 {
   text-align:center;
}

.item .content {
   width:61%;
   float:left;
   padding-left:21px;
   box-sizing:border-box;
}

.item .image {
   width:201px;
   float:left;
}

.item img {
   width:100%;
}

.item .content ul {
   border-left:3px solid yellow;
   margin-bottom:21px;
}
</style> 
 </head> 
 <body> 
  <section id="example"> 
   <ul> 
    <li class="item"> <h2>Lorem ipsu</h2> 
     <div class="content"> 
      <h3>Lorem ipsu</h3> 
      <ul> 
       <li>Lorem ipsum dolor sit amet, consectetur adipiscing e</li> 
       <li>Lorem </li> 
       <li>Lore</li> 
      </ul> 
     </div> 
     <div class="image"> 
      <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> 
     </div> </li> 
    <li class="item"> <h2>Lorem ip</h2> 
     <div class="content"> 
      <h3>Lorem ipsu</h3> 
      <ul> 
       <li>Lore</li> 
       <li>Lorem ipsum</li> 
       <li>Lorem</li> 
      </ul> 
     </div> 
     <div class="image"> 
      <img src="https://www.java2s.com/style/demo/Firefox.png"> 
     </div> </li> 
   </ul> 
  </section>  
 </body>
</html>

Related Tutorials