Home > Article > Web Front-end > CSS: How to write vertical and horizontal centering of DIV interface_html/css_WEB-ITnose
If you want to keep a DIV centered vertically and horizontally at the same time, you can use the following CSS code to achieve it:
{width:612px; height:470px; margin-top:-235px; margin-left:-306px ; position:absolute; top:50%; left:50%;}