javascript - How to dynicamlly center the center of a div based on screen size -
i thought simple i'm losing mind! simple want center div in div of screen. not top left of div center of screen center of div in center.
here div css
.box { padding-top:20px; padding-left:5px; background-color: #ffffff; background-color: rgba(221,221,221,0.5); border: 1px solid black; border-radius: 25px; filter: alpha(opacity=90); height: 125px; width: 250px; z-index: 1; } <form id="form1" runat="server"> <div id="box"><div> </form>
thanks! couldnt figure out how html side in code block. center horizontally , vertically.
use position:absolute if need centred both horizontally , vertically:
#box { position:absolute; top:0; left:0; right:0; bottom:0; margin:auto; /* etc */ }
Comments
Post a Comment