zoukankan      html  css  js  c++  java
  • 如何让DIV里面的DIV水平垂直居中

     1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     2 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <head>
     4 <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
     5 <title>TEST</title>
     6 <style type="text/css">
     7 <!--
     8 body,td,th  {
     9 color: #ffffff;
    10 font-family: Verdana;
    11 font-size:9pt;
    12 }
    13 #layout{
    14 background-color: #ff0000;
    15 width: 600px;
    16 height:90px;
    17 position:relative;
    18 }
    19 #left{
    20 background-color: #999999;
    21 width: 100px;
    22 height:90px;
    23 float:left;
    24 }
    25 #right{
    26 background-color: #888888;
    27 width: 100px;
    28 height:90px;
    29 float:right;
    30 }
    31 #center{
    32 background-color: #cccccc;
    33 width: 100px;
    34 height:30px;
    35 position:absolute;
    36 left:50%;
    37 top:50%;
    38 margin-left:-50px;
    39 margin-top:-15px;
    40 }
    41 -->
    42 </style>
    43 </head>
    44 <body>
    45 <div id="layout">
    46 <div id="left">左边</div>
    47 <div id="center">中间</div>
    48 <div id="right">右边</div>
    49 </body>
    50 </html>

  • 相关阅读:
    【转】java线程池ThreadPoolExecutor使用介绍
    java的类加载机制
    java面试问题分类
    ConcurrentHashMap总结
    ffmpeg对视频封装和分离
    SSM的整合
    单例模式的七种写法
    SecureCRT的快捷键
    linux下mysql常用命令
    maven操作
  • 原文地址:https://www.cnblogs.com/yanni/p/3294941.html
Copyright © 2011-2022 走看看