HTML CSS examples for CSS Layout:Absolute Position
center position:absolute element in a responsive layout
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .slider {<!-- w w w. j a v a2s. c om--> background-color:Chartreuse; position:relative; width:100%; min-height:100%; padding:251px 0; } .center-line { position:absolute; background-color:yellow; top:0; left:51%; transform:translateX(-51%); width:3px; height:100%; } .owl-dots { display:inline-block; position:absolute; top:81px; left:51%; transform:translateX(-51%); } .owl-dot { display:block; width:11px; height:11px; background-color:blue; border-radius:51%; margin:11px 0; } .owl-dot.active { background-color:pink; } @media (max-width: 750px) { .owl-dots { top:306px !important; } .owl-dot { display:inline-block; margin:0 6px; } } </style> </head> <body> <div class="slider container"> <div class="center-line"> Lor </div> <div class="owl-dots"> <div class="owl-dot active"> <span></span> </div> <div class="owl-dot"> <span></span> </div> <div class="owl-dot"> <span></span> </div> <div class="owl-dot"> <span></span> </div> </div> </div> </body> </html>