【问题标题】:html table border existshtml表格边框存在
【发布时间】:2012-12-24 14:13:10
【问题描述】:

嘿,我有个小问题,我已经设置好了

border: none;
border-width: 0px;
border-spacing: 0px;
border-collapse: collapse;
padding: 0px;
margin: 0px;

对于table,td和tr,但是tr节点之间还是有1px的边框。

HTML代码:

<table>
  <tr>
    <td>
      <a href='url'> some text </a>
    </td>
    <td>
      <a href='url'> some text </a>
    </td>
  </tr>
</table>

因为我已经设置了

display: block;
color: white;
font-size: 13px;
text-decoration: none;
height: 24px;
padding: 9px 19px 1px;
font-weight: 600;
text-align: center;

将填充更改为 0,不给出任何结果。

有什么解决办法吗?

浏览器:最后一个 chrome,firefox。

操作系统 MAC OS 10.8

【问题讨论】:

  • table 是否指定了cellspacing

标签: html border html-table


【解决方案1】:

我认为你的代码是对的?

这是你想看的吗?

设置

border-collapse:collapse;
border:none;

够了..

【讨论】:

    【解决方案2】:

    尝试使用:

    border-style: none;
    

    请注意,这在某些版本的 IE 中不起作用。 IE9 很好,但在以前的版本中,即使样式为“无”,它也会显示边框

    border: 0;
    

    似乎适用于所有浏览器...

    【讨论】:

      【解决方案3】:

      您需要在表格样式中输入border-collapse: collapse;,在单元格中输入border-spacing: 0px; padding: 0px;。请参阅下面的示例代码。

      <!DOCTYPE html>
      <html>
          <head>
          <meta charset="UTF-8">
      
          <style>
              table {border-collapse: collapse;}
              table tr {}
              table td {border-spacing: 0px; padding: 0px;}
          </style>
      
      </head>
      <body>
      
      
          <table>
             <tr>
                <td>
                   <a href='url'> some text </a>
                </td>
                <td>
                   <a href='url'> some text </a>
                </td>
             </tr>
          </table>
      </body>
      </html>
      

      【讨论】:

      • 为表格样式提供完整的 CSS 编写,而不仅仅是属性。
      • 就这些了,其他属性只包含继承属性,
      • 在这种情况下,您没有指定将这些属性应用于什么... 以上面的代码为例,它已经过尝试和测试并且可以工作。如果您在使用上述 CSS 后无法使其正常工作,请使用您的代码创建一个 jfiddle,我会为您查找。
      猜你喜欢
      • 2013-06-20
      • 2013-10-26
      • 1970-01-01
      • 2017-10-11
      • 2013-03-06
      • 1970-01-01
      • 2015-09-28
      • 2012-02-02
      • 2011-09-16
      相关资源
      最近更新 更多