我有一个非常简单的表的代码:
<table cellspacing="10" cellpadding="10">
<tr>
<td><div id="mini_window"></div></td>
<td><div id="mini_window"></div></td>
<td><div id="mini_window"></div></td>
</tr>
</table>
此表格代码在此div中:
#body_content {
top: 30%;
left: 36%;
width:70%;
height:18em;
margin-top: -9em; /*set to a negative number 1/2 of your height*/
margin-left: -15em; /*set to a negative number 1/2 of your width*/
border-bottom: 1px solid #ccc;
border-top: 1px solid #ccc;
/*background-color: #f3f3f3;*/
position:fixed;
direction: rtl;
}
在表格单元格中,有一个mini_window div:
#mini_window {
top: 50%;
width:150px;
height:150px;
margin-top: 20px; /*set to a negative number 1/2 of your height*/
/*border-bottom: 1px solid #ccc;*/
/*border-top: 1px solid #ccc;*/
border: 1px solid black;
background-color: #f3f3f3;
/*direction: rtl;*/
}
看起来像附图,这不是我想要的。我需要在每个div之间说20px或更少。出了什么问题?
更新:包括该页面的完整来源:
<html>
<head>
<?php include_once('required_css.php'); ?>
<?php include_once('required_js.php'); ?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<?php include_once('header.php'); ?>
<div id="body_content">
<h1>ما الجديد؟</h1>
<table cellspacing="10" cellpadding="10">
<tr>
<td><div id="mini_window"></div></td>
<td></td>
<td><div id="mini_window"></div></td>
<td></td>
<td><div id="mini_window"></div></td>
</tr>
</table>
</div>
</body>
</html>
答案 0 :(得分:1)
您应该添加保证金:10px;
#mini_window {
top: 50%;
width:150px;
height:150px;
margin: 10px;
margin-top: 20px; /*set to a negative number 1/2 of your height*/
/*border-bottom: 1px solid #ccc;*/
/*border-top: 1px solid #ccc;*/
border: 1px solid black;
background-color: #f3f3f3;
/*direction: rtl;*/
}