热门文章 | 热门软件| 热门源码 | 热门电影 | 知识库 | 联系我们
软件 源码 教程 影视 健康 招聘
  HTML | JavaScript | ASP | PHP | JSP | NET | VB | VC | VF | Windows | Linux | Mysql | Mssql | Oracle | Struts 
当前位置: 创世纪计算机资源网 -> 文章频道 ->css 
站内搜索:
让div层居中的两个方法
作者:大灰狼 来源:www.gold98.net 整理日期:2007-11-12
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>div</title>
<style>
#main_container{
border:1px solid #000000;
height:400px;
width:600px;
margin-right:auto;
margin-left: auto;

}
#main_container2{
width:500px;
background-color:red;
left:50%;
margin-left:-260px;

position:relative;
}
</style>
</head>
<body>
<div id="main_container">
div1
</div>
<div id="main_container2">
div 2
</div>
</body>
</html>
相关文章