css实现的div垂直居中效果代码实例_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:27:43
Original
1877 people have browsed it

css实现的div垂直居中效果代码实例:
关于div垂直居中效果,在网上已经有很多介绍了。
本章节再来通过代码实例演示一下如何实现此效果,希望能够给需要的朋友带来帮助。
代码实例如下:

<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css">#box{  width:400px;  height:200px;  background:#CCC;  position:relative;}#inner{  width:50px;  height:50px;  background:green;  position:absolute;  left:50%;  top:50%;  margin-left:-25px;  margin-top:-25px;}</style></head><body><div id="box">  <div id="inner"></div></div></body></html>
Copy after login

上面的代码非常的简单,这里就不多介绍了,如有任何问题可以跟帖留言。

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

更多内容可以参阅: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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!