HTML CSS examples for CSS Layout:Position
position :after element to 50% of target element height
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> div {<!-- w w w.jav a 2 s. c o m--> position:relative; height:201px; width:201px; background-color:Chartreuse; } div::after { content:"Middle"; position:absolute; top:51%; left:0; transform:translateY(-51%); } </style> </head> <body> <div></div> </body> </html>