Home >Web Front-end >HTML Tutorial >DIV centered CSS_html/css_WEB-ITnose

DIV centered CSS_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 12:30:501184browse

When you are new to CSS, you often encounter the situation of positioning DIV. This CSS can make the DIV automatically centered:

position: absolute; width:420px; height:230px; left :50%; top:50%;margin-left:-250px; margin-top:-100px; border: 1px solid #ccc;

Collect so you won’t forget

position: absolute; yes Absolute positioning

position:relative; is the superior element relative to the current element

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