【问题标题】:Text-decoration: none using table --having trouble文字装饰:没有使用表格--有麻烦
【发布时间】:2016-07-06 05:45:48
【问题描述】:

尽管这对你们大多数人来说似乎微不足道,但对于某些人来说,我无法在表格单元格中应用text-decoration:none,如下所示。

我的 CSS 做错了什么?

任何意见将不胜感激

table{
  font-size: 50px;
}

table a{
  text-decoration: none;
}
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" rel="stylesheet"/>
<div>
  <table>
    <tbody>
      <tr>
        <td>
          <a href="http://www.google.com"><i class="fa fa-quote-left" aria-hidden="true"></i></a>
          <p>Quote Master</p>
        </td>
      </tr>
    </tbody>
  </table>
</div>

【问题讨论】:

  • 文本装饰似乎按照您的代码工作,必须有一些其他 css 冲突或某些类正在应用于您的代码。
  • 这里一样,代码工作正常。你能解释一下你想在这里实现什么吗?
  • 对不起,我提出了错误的问题:我在问如何将超链接颜色覆盖为其默认值,而只是一个简单的谷歌搜索帮助我。对于那些好奇的人:a{颜色:继承}感谢所有试图帮助我的人:)

标签: html css text-decorations


【解决方案1】:

如果您想要黑色,请将color: inherit 应用于锚标记。

一般锚标记的颜色是'紫色'(#0000EE;),如果你看到任何地方,
例如:谷歌搜索结果所有链接都包含紫色链接。

如果我们应用color: 'inherit',父级的颜色将被应用到锚点上,覆盖默认颜色,如果它也不是黑色,你可以显式声明color: 'black'给那个锚点。

table{
  font-size: 50px;
  }

table a{
  text-decoration: none;
  color: inherit
 }
<link href="http://maxcdn.bootstrapcdn.com/font-awesome/4.6.0/css/font-awesome.min.css" rel="stylesheet"/>
        <div>
          <table>
            <tbody>
              <tr>
                <td>
                    <a href="http://www.google.com"><i class="fa fa-quote-left" aria-hidden="true"></i></a>
                    <p>Quote Master</p>
                </td>
              </tr>
              </tbody>
          </table>
      </div>

【讨论】:

  • 是的!我问错了问题,但这就是答案。干杯
  • 你的问题是正确的,是锚标签的行为让你感到困惑。
猜你喜欢
  • 2011-01-09
  • 2019-07-01
  • 1970-01-01
  • 2012-07-10
  • 2013-07-29
  • 2011-04-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多