删除表边框

时间:2011-06-09 08:31:58

标签: html css asp.net-mvc-3

我无法摆脱这个桌边。

最初的HTML / CSS来自ASP.NET MVC默认值。

我删除了很多代码并在顶部添加了一个表。

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
</head>
<body>

    <div class="page">

            <table border=0 width=1000 style="border-collapse:collapse;" cellspacing="0" cellpadding="0">
                <tr>
                    <td rowspan=2>
                        <img src="/Content/Images/elk_banner.jpg" />
                    </td>
                    <td>
                        <div id="logindisplay">
                        @Html.Partial("_LogOnPartial")
                        </div>
                    </td>
                </tr>
            </table>

        <section id="main">
            @RenderBody()
        </section>
        <footer>
        </footer>
    </div>
</body>
</html>

我已经尝试过评论所有的CSS,但我无法摆脱它。

我唯一的猜测是,其中一个神秘的.js文件正在干扰它。或者其中一个充满异国情调的HTML容器就是这样做的。

任何猜测?我用Google搜索,但无济于事。我想这是我忽略的小事。

10 个答案:

答案 0 :(得分:17)

尝试为您的表格提供ID,然后使用!important在CSS中将border设置为none。如果JavaScript篡改了你的表,那么应该绕过它。

<table id="mytable"
...

table#mytable,
table#mytable td
{
    border: none !important;
}

答案 1 :(得分:11)

请尝试将其添加到表格标记内。

border =“0”cellspacing =“0”cellpadding =“0”

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

答案 2 :(得分:6)

这将使用border-collapse

table{
    border-collapse:collapse;
}

答案 3 :(得分:5)

要从所有表格中删除(将其添加到头部或外部样式表)

<style type="text/css">
table td{
border:none;
}
</style>

The image shows where the style is coming from (Firebug)

答案 4 :(得分:3)

使用Firebug检查有问题的表,并查看它从何处继承边界。 (查看右栏)。尝试设置即时内联样式边框:无;看看你是否摆脱它。 也可以是浏览器的默认样式表。在这种情况下,请使用CSS重置。 http://developer.yahoo.com/yui/reset/

答案 5 :(得分:2)

大多数情况下,您的背景颜色与您桌子的背景不同。由于单元格之间存在空格,因此这些空间将创建具有桌子后面背景颜色的线条的错觉。

解决方案是摆脱那些空间。

在表格标签内写:

cellspacing="0"

答案 6 :(得分:2)

在表级使用表格样式边框折叠

答案 7 :(得分:1)

border-spacing: 0;也可以正常使用

答案 8 :(得分:0)

根据您的情况,您需要在<table><td>标签上将边框设置为无。

    <table width=1000 style="border:none; border-collapse:collapse; cellspacing:0; cellpadding:0" >
        <tr>
            <td style="border:none" rowspan=2>
                <img src="/Content/Images/elk_banner.jpg" />
            </td>
            <td style="border:none">
                <div id="logindisplay">
                    @Html.Partial("_LogOnPartial")
                </div>
            </td>
        </tr>
    </table>

答案 9 :(得分:-2)

.yourClass>tbody>tr>td{border: 1px solid #ffffff !important;}
相关问题