本站为一个技术型PHP个人门户站,提供一些代码,技术文章、免费空间消息信息、让学习编程更轻松和不要钱买空间更方便-PHP小戴
你当前的位置:首页>>建站代码>>css+js代码

如何让DIV层上下左右都居中

  • 解决上下左右都居中的div图层,高度和宽度确定的情况下,
    <html >
    <head>
    <meta http-equiv="content-type" content="text/html; charset=gb2312" />
    <meta name="author" content="Smiling Dolphin" />
    <meta name="keywords" content="azhong.com" />
    <meta name="description" content="my favorites language." />
    <meta name="robots" content="all" />
    <title>解决上下左右都居中的div图层 css</title>

    <style type="text/css" title="currentStyle" media="screen">
    #center{
       position:absolute;
       top:50%;
       left:50%;
       margin-top:-200px;
       margin-left:-300px;
       width:600px;
       height:400px;
       border:1px solid #333333;
    }
    </style>
    </head>
    <body>
    <div id="center">
       margin-top:-200px;
       margin-left:-300px;重点
       width:600px;
       height:400px;
    这个就是利用参数的倍数关系!,主要倍数的关系

    ,不过感觉如果扎们高度不确定的情况下怎么半了,哦我也不知道了,
    </div>
    </body>
    </html>


  • [时间:2008-12-11 10:17:22][点击:]

  • 上下篇文章加载中...
本站关键字:宁波网络公司/宁波网站建设公司/宁波网站制作公司/宁波做网站公司