HR Margin issue with IE6, IE8 & FF

2019-08-24 03:55发布

HI ,

I am getting Gap(some white space) between the <HR> & <TABLE> tags in IE6. But the same code is working differently in IE8 & FF. Here is the my sample code.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<style>
* {
    margin: 0px;
    padding: 0px;
}
</style>
</head>
<body>
<div style="display: inline; height: 100%;" id="printdiv">
<table width="70%" id="Tableprint">
    <tbody>
        <tr>
            <td style="padding-left: 15px;">
            <table width="100%" style="border: 0px solid rgb(204, 204, 204);">
                <tbody>
                    <tr>
                        <td nowrap="" colspan="2">
                        <span class="formLabel">dev site</span>
                        <span class="bodyText">Transfer Secure </span></td>
                    </tr>
                    <tr>
                        <td nowrap="" align="left" width="50%" valign="bottom">
                            <span><b>Current Date:Wednesday, 02 Mar 2011, 01:42 IST</b></span>
                        <span><b>Report Date</b></span>
                        <span>Wednesday,20 Oct 2010</span></td>
                        <td align="right" valign="bottom">
                            <input type="button" id="Buttoncancel" value="BACK">
                        </td>
                    </tr>
                </tbody>
            </table>
            <hr align="left" width="100%">
            <table cellspacing="0" width="100%" style="border: 1px;">
                <thead>
                    <tr>
                        <td style=" width: 10%; padding-left: 5px;"><b>Column1</b></td>
                        <td align="right" style="padding-bottom: 3px; font-weight: bold;">Credit</td>
                    </tr>
                </thead>
            </table>
            <hr align="left" width="100%">
            <div id="Footer">
            <table cellspacing="0" cellpadding="0" border="0" width="100%">
                <tbody>
                    <tr>
                    <td align="right">Test Data</td>
                    </tr>
                </tbody>
            </table>
            </div>
            </td>
        </tr>
    </tbody>
</table>
</div>
</body>
</html>

If I add the following style then I am getting space in IE 8 & FF but the problem is in IE 6 I am seeing extra space around the <HR>

hr {
    margin-bottom: 7px;
    margin-top: 7px;
}

Please Help me in this.

Thanks in Advanceenter code here

1条回答
\"骚年 ilove
2楼-- · 2019-08-24 04:24

Add this CSS:

table, tr, td, hr {
    line-height: 1.15;
}
hr {
    clear: both;
    display: block;
    *margin: -7px 0; /* ie7 and below */
}

This helped me, but the site isn't working properly, so here's a cached link.

查看更多
登录 后发表回答