HTML CSS examples for CSS Widget:Image Align
Align image inside DIV horizontally and vertically
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> img {<!--from w w w . j av a2 s . c o m--> max-width:100%; vertical-align:middle; margin-top:51%; position:relative; top:-38px; } #slika { float:left; height:127px; width:112px; text-align:center; border:2px solid Chartreuse; } </style> </head> <body> <div id="slika"> <img src="https://www.java2s.com/style/demo/Opera.png" width="auto" height="auto" alt="https://www.java2s.com/style/demo/Google-Chrome.png"> </div> </body> </html>