Home  >  Article  >  Web Front-end  >  CSS: How to write vertical and horizontal centering of DIV interface_html/css_WEB-ITnose

CSS: How to write vertical and horizontal centering of DIV interface_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:32:481208browse

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%;}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn