HTML CSS examples for CSS Widget:Image Text
Center text vertically with an image
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .holder {<!-- w w w. j a v a2 s . com--> border:2px solid Chartreuse; padding:11px; width:301px; display:table; } .cell { display:table-cell; vertical-align:middle; text-align:left; } .cell:nth-child(1) { width:106px; } img { width:100px; } </style> </head> <body> <div class="holder"> <div class="cell"> <img src="https://www.java2s.com/style/demo/Safari.png" style="float: left;"> </div> <div class="cell"> <a href="#" class="centered">Lorem ipsu</a> </div> </div> </body> </html>