HTML CSS examples for CSS Layout:Absolute Position
enforce absolute positioning and line height with CSS
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> div {<!-- w w w .j av a 2s . co m--> position:relative; } a.mainWrap { display:block; margin:0 14px 14px 0; width:223px; position:relative; height:226px; } .imgInfoBottom.imgInfoBottomShops { bottom:4px; height:36px; padding:11px 15px; vertical-align:middle; width:195px; color:Chartreuse; font-size:31px; } .imgInfoBottom { position:absolute; bottom:0; left:0; width:273px; padding:16px 14px 14px 16px; background:black; background-color:yellow; } .totalVisProducts { color:blue; font-size:58px; font-weight:bold; position:absolute; top:31%; margin:0 auto; text-align:center; width:100%; } </style> </head> <body> <div> <a class="dB" href="/shops/23/"> <img height="222px" src="https://www.java2s.com/style/demo/InternetExplorer.png" weight="222px" alt="Art" title="Art"> <span class="imgInfoBottom imgInfoBottomShops"> <span class="floatLeft"> <h3>Lore</h3> </span> <span class="viewDet floatRight round20 fabGrad"> <span class="fabShopSprite gtIcon imgInfoArrow"></span> </span> </span> <span class="totalVisProductsBG"> <span class="totalVisProducts">Lor</span> </span> </a> </div> </body> </html>