Jquery中文网 www.jquerycn.cn
Jquery中文网 >  CSS教程  >  经典实例  >  正文 css垂直水平居中代码

css垂直水平居中代码

发布时间:2020-05-15   编辑:www.jquerycn.cn
jquery中文网为您提供css垂直水平居中代码等资源,欢迎您收藏本站,我们将为您提供最新的css垂直水平居中代码资源

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.111cn.net/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>css垂直水平居中代码</title>
<style type="text/css">

 代码如下
 .cncenter{
  height:30px;
  width:600px;
  margin:0px auto;
  background:#0c6;
 }


</style>
</head>
<body>
<div class="cncenter">
</div>
</body>
</html>

div居中的完美解决方案! (水平垂直居中)
1,关于居中使用css为:position:fixed;left:50%;top:50%;margin-left:width/2;margin-top:height/2;
对于ie6,只能把position:改成absolute;

 

 

您可能感兴趣的文章:
CSS中未知高度水平垂直居中实例
css实现在div水平垂直居中与图片水平居中的效果
css3内容垂直居中及垂直滚动条例子
css div水平垂直居中几个例子
css实现body背景图片水平垂直居中方法
css3实现图片在容器中等比例缩放及水平垂直居中
css中文字图片背景图居中的方法汇总
未知大小图片在已知容器中的垂直和水平居中问题
css中元素水平垂直居中4种方法介绍
css垂直水平居中代码

[关闭]