div里面的div有一个1像素的边框。它怎么能被删除?

时间:2013-02-25 15:40:51

标签: html html-table border

我在td中有一个div,我似乎无法移除它周围的1 px边框。 如果我尝试添加td {padding:0},边框将消失,但div跳转到左侧,变量td自动更改为0px宽度。 如何在不弄乱整个桌子的情况下移除div周围的边框?

HTML:

<table>
    <tr>
        <td class="header-left"></td>
        <td class="header">
            <div class="header-image"></div>
        </td>
        <td class="header-right"></td>
    </tr>
</table>

CSS:

table {
width:100%;
border-spacing: 0;
}

.header-left {
height:100px;
background-image:url(img/header-left.png);
background-repeat:repeat-x;

}

.header-right {
height:100px;
background-image:url(img/header.png);
background-repeat:repeat-x;
}

.header {
height:100px;
width:960px;
background-image:url(img/header.png);
background-repeat:repeat-x;
margin:0 auto;
}

.header-image {
height:100px;
width:548px;
background-repeat:no-repeat;
background-image:url(img/header-image.png);
}

4 个答案:

答案 0 :(得分:0)

<table cellspacing="0" cellpadding="0" border="0"></table>

这样,您在表格中创建的td周围就不会有任何间距。

答案 1 :(得分:0)

在DIV TAG中添加以下代码

<DIV class ="header-image" style="border:0px">  

或者如果表边框有问题,请设置table border=0

答案 2 :(得分:0)

你需要设置表的属性,如下所示

<table cellpadding="0" cellspacing="0" border="0">

在css更改中尝试以下

table { border:none;}

如果仍然没有得到解决方案给我示例有div的边框,因为在这里我看不到div周围的任何边框

答案 3 :(得分:0)

尝试:

边框:类标题中没有 要么 创建全局类 表{border-collapse:collapse; border-spacing:0;边界:0; }