Home > Web Front-end > HTML Tutorial > CSS让div水平居中实例代码_html/css_WEB-ITnose

CSS让div水平居中实例代码_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:31:26
Original
1599 people have browsed it

CSS让div水平居中实例代码:
在布局中,往往希望一个div是水平居中的,对于如何让div水平居中,稍有经验的人员都不成问题,只需要一句代码就可以搞定,但是初学者往往可能不清楚,废话不多说了,直接给出代码。

 

.box{  width:200px;  height:200px;  margin:0px auto;} 
Copy after login

 

在这里必须要注意的是,div宽度必须要认为的设置,否则无法设置居中。

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=9497

更多内容可以参阅:http://www.softwhy.com/divcss/

 

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template