Vertical text alignment Centre - HTML CSS CSS Layout

HTML CSS examples for CSS Layout:Text

Description

Vertical text alignment Centre

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">
ul {<!--from  w w w .  j  a v  a 2  s  . c o m-->
   width:111px;
   display:block;
}

li {
   background-image:url('https://www.java2s.com/style/demo/Google-Chrome.png');
   font:bold 11px Arial, Helvetica;
   height:auto;
   color:Chartreuse;
   text-align:center;
   vertical-align:middle;
   display:block;
   border:2px solid yellow;
}

a {
   display:block;
   height:100%;
   width:100%;
   padding-top:11px;
   padding-bottom:11px;
}

a:hover {
   background:red;
}

a span {
   position:relative;
}
</style> 
 </head> 
 <body> 
  <ul> 
   <li> <a href="fooPage.html" target="innerPane"> <span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ullamcorper molestie lacus sed fermentum. Aliquam</span> </a> </li> 
   <li> <a href="fooPage.html" target="innerPane"> <span>Lorem ip</span> </a> </li> 
   <li> <a href="fooPage.html" target="innerPane"> <span>Lorem ip</span> </a> </li> 
  </ul>  
 </body>
</html>

Related Tutorials