HTML CSS examples for CSS Layout:Flex Center
In Flexbox centering absolute element
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .banner {<!--from w w w . j a v a 2 s . c om--> overflow:hidden; position:relative; height:601px; width:351px; } .banner img { position:absolute; z-index:0; left:51%; top:51%; transform:translate(-51%, -51%); } .banner figcaption { display:table; width:91%; z-index:2; position:absolute; bottom:0; top:0; left:0; right:0; margin:auto; } .banner figcaption p, h3, a { background-color:Chartreuse; line-height:41px; margin:0; text-align:center; width:100%; display:block; } </style> </head> <body> <figure class="banner"> <img src="https://www.java2s.com/style/demo/Opera.png"> <figcaption> <p>TEXT</p> <h3>TITLE</h3> <p>TEXT</p> <a href="">DETAIL</a> </figcaption> </figure> </body> </html>