CSS vertical align text with image - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text Alignment

Description

CSS vertical align text with image

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">
.bar {<!--from   w w w  . ja  v  a2  s.c o  m-->
   background:Chartreuse;
   padding:0;
   margin:0;
}

.bar a {
   display:inline-block;
   vertical-align:top;
   background:yellow;
   font-family:'OpenSans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
   font-size:11px;
   height:19px;
   line-height:21px;
   padding:0 0 0 6px;
}

.bar a:after {
   display:inline-block;
   vertical-align:top;
   content:"";
   height:19px;
   width:19px;
   background:url('https://www.java2s.com/style/demo/Google-Chrome.png') no-repeat center;
}
</style> 
 </head> 
 <body> 
  <div class="bar"> 
   <a>Lorem ip</a> 
   <a>Lorem </a> 
  </div>  
 </body>
</html>

Related Tutorials