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

div垂直水平居中实例代码_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:31:111139browse

div垂直水平居中实例代码:
关于让div垂直水平居中的效果太多了,这里就不介绍了,废话不多说,直接给出代码。
代码实例如下:

<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>垂直水平居中代码</title><style type="text/css">body {  background-color:#e1ddd9;  font-size:12px;  padding:0px;  margin:0px;}#inhalt {  position:absolute;  height:200px;  width:400px;  margin:-100px 0px 0px -200px;  top:50%;  left:50%;  text-align:left;  padding:0px;  background-color:#f5f5f5;  border:1px dotted #000000;  overflow:auto;}</style></head><body><div id="inhalt"></div></body></html>

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

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

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