如何让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>

原文地址:https://www.cnblogs.com/yanni/p/3294941.html