zoukankan      html  css  js  c++  java
  • 上下两个表格之间为什么中间会有大约5象素的间距?

    今天发现一个问题:上下两个表格中间有大约5象素的间距。
    代码是这样的

    <!--head-->
        <div align="center">
            <table width="778" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <img src="images/head.gif"></td>
                </tr>
            </table>
        </div>
        <!--end head-->
        <!--menu-->
        <div align="center">
            <table width="778" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <img src="images/menu_1.gif" width="8" height="37" alt=""></td>
                    <td>
                        <img src="images/menu_2.gif" width="668" height="37" alt=""></td>
                    <td>
                        <img src="images/menu_3.gif" width="13" height="37" alt=""></td>
                    <td>
                        <img src="images/menu_4.gif" width="67" height="37" alt=""></td>
                    <td>
                        <img src="images/menu_5.gif" width="22" height="37" alt=""></td>
                </tr>
            </table>
        </div>
        <!--end menu-->

    最后经过调试,终于发现是因为head中image的宽度和高度没有设定。改成下面的代码即可。

    <!--head-->
        <div align="center">
            <table width="778" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <img src="images/head.gif" width="778" height="98" alt=""></td>
                </tr>
            </table>
        </div>
        <!--end head-->
        <!--menu-->
        <div align="center">
            <table width="778" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <img src="images/menu_1.gif" width="8" height="37" alt=""></td>
                    <td>
                        <img src="images/menu_2.gif" width="668" height="37" alt=""></td>
                    <td>
                        <img src="images/menu_3.gif" width="13" height="37" alt=""></td>
                    <td>
                        <img src="images/menu_4.gif" width="67" height="37" alt=""></td>
                    <td>
                        <img src="images/menu_5.gif" width="22" height="37" alt=""></td>
                </tr>
            </table>
        </div>
        <!--end menu-->

    如果还有间隔的话,把<td><img src="" width="" height=""></td> 中间不要留空格。

  • 相关阅读:
    jQuery.API源码深入剖析以及应用实现(4) - 选择器篇(下)
    jquery表单应用
    随笔 没顾虑
    jquery基础技巧总结
    jQuery.API源码深入剖析以及应用实现(3) - 选择器篇(上)
    JQuery语法总结和注意事项
    5个jQuery问题和解答
    Jquery编辑数据
    jquery 对checkbox的操作
    有关jQuery动画的认识
  • 原文地址:https://www.cnblogs.com/ami/p/455768.html
Copyright © 2011-2022 走看看