css - 减少 HTML 表格对齐之间的空间

标签 css html styles

如何减少以下代码的并行表之间的空间?数据网格表格放置在页面对齐的最末端,外观看起来有点奇怪。

任何人都可以建议我如何管理表格的对齐方式以减少放置在左侧和右侧每个末端的表格的空间?

注意:将代码复制到记事本中,另存为test.html扩展名,然后在IE或Firefox中打开,检查我上面讨论的对齐问题。

代码如下:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Server status</title>
        <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
        <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
        <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
    </head>
    <body><br/><br/><br/><br/>
        <div style="float:right;"><table id="ll" class="easyui-datagrid" style="width:380px;height:auto;">
                <thead>
                    <tr><th field="name2" width="80">Status</th></tr>
                </thead>
                <tbody>
                    <tr> <td>India</td></tr>
                    <tr><td>Canada</td></tr>
                    <tr><td>USA</td></tr>
                    <tr><td>UK</td></tr>
                </tbody>
            </table>
        </div>
        <div style="float:bottom;"><table id="gg" class="easyui-datagrid" style="width:380px;height:auto;">
                <thead>
                    <tr><th field="name2" width="80">Status</th></tr>
                </thead>
                <tbody>
                    <tr> <td>India</td></tr>
                    <tr><td>Canada</td></tr>
                    <tr><td>USA</td></tr>
                    <tr><td>UK</td></tr>
                </tbody>
            </table>
        </div><br/><br/><br/>
        <div style="float:left;"><table id="ss" class="easyui-datagrid" style="width:380px;height:auto;">
                <thead>
                    <tr><th field="name2" width="80">Status</th></tr>
                </thead>
                <tbody>
                    <tr> <td>India</td></tr>
                    <tr><td>Canada</td></tr>
                    <tr><td>USA</td></tr>
                    <tr><td>UK</td></tr>
                </tbody>
            </table>
        </div>
        <div style="float:right;"><table id="vv" class="easyui-datagrid" style="width:380px;height:auto;">
                <thead>
                    <tr><th field="name3" width="80">Status</th></tr>
                </thead>
                <tbody>
                    <tr><td>India</td></tr>
                    <tr><td>China</td></tr>
                    <tr><td>Oz</td></tr>
                    <tr><td>UK</td></tr>
                </tbody>
            </table>
        </div> 
    </body>
</html>

最佳答案

请用以下代码替换您的代码

    <html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Server status</title>
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
</head>
<body><br/><br/><br/><br/>
<div style="width:780px; overflow:hidden; margin:0 auto; margin-bottom:20px;">
 <div style="float:right;">
 <table id="ll" class="easyui-datagrid" style="width:380px;height:auto;">
  <thead>
    <tr><th field="name2" width="80">Status</th></tr>
  </thead>
  <tbody>
    <tr> <td>India</td></tr>
    <tr><td>Canada</td></tr>
    <tr><td>USA</td></tr>
    <tr><td>UK</td></tr>
  </tbody>
</table>
</div>
 <div style="float:left;">
 <table id="ss" class="easyui-datagrid" style="width:380px;height:auto;">
  <thead>
    <tr><th field="name2" width="80">Status</th></tr>
  </thead>
  <tbody>
    <tr> <td>India</td></tr>
    <tr><td>Canada</td></tr>
    <tr><td>USA</td></tr>
    <tr><td>UK</td></tr>
  </tbody>
</table>
</div>
</div>

<div style="width:780px; overflow:hidden;  margin:0 auto; ">
<div style="float:left;">
<table id="gg" class="easyui-datagrid" style="width:380px;height:auto;">
  <thead>
    <tr><th field="name2" width="80">Status</th></tr>
  </thead>
  <tbody>
    <tr> <td>India</td></tr>
    <tr><td>Canada</td></tr>
    <tr><td>USA</td></tr>
    <tr><td>UK</td></tr>
  </tbody>
</table>
</div>
<div style="float:right;">
<table id="vv" class="easyui-datagrid" style="width:380px;height:auto;">
  <thead>
    <tr><th field="name3" width="80">Status</th></tr>
  </thead>
  <tbody>
    <tr><td>India</td></tr>
    <tr><td>China</td></tr>
    <tr><td>Oz</td></tr>
    <tr><td>UK</td></tr>
  </tbody>
</table>
</div> 
</div>

</body>
</html>

关于css - 减少 HTML 表格对齐之间的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24449763/

相关文章:

javascript - google+ 登录 - 如何隐藏 clientid?

Javascript/jQuery 更改内联样式值

javascript - 替换 html 元素 bu 类的 style 属性

html - css 的特定编辑器设置?

javascript - 在页面的一部分上规范化-css

css - 使用 CSS 在 Flex 4.5 中设计 Accordion 标题的样式

html - 悬停时显示带有动画的div

php - 选择的 HTML 选择选项不起作用

jQuery 动画移动多个 div 的边距

html - 淡入淡出的按钮过渡不起作用