Vertical text centering in <a> vs <button> - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Button

Description

Vertical text centering in <a> vs <button>

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dolor sit amet, consectet</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
* {<!--  w  w w  .ja v a2  s  . c  om-->
   box-sizing:border-box;
}

a, button {
   height:201px;
   background-color:Chartreuse;
   color:yellow;
   font-weight:bold;
   display:inline-block;
   vertical-align:top;
   border:0;
   padding:21px;
   text-decoration:none;
}

a {
   display:table-cell;
   vertical-align:middle;
}
</style> 
 </head> 
 <body> 
  <a href="#">Lore</a> 
  <button>Lorem </button>  
 </body>
</html>

Related Tutorials