无法取消嵌套元素的换行符 [英] Unable to un-line-through a nested element

查看:158
本文介绍了无法取消嵌套元素的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想对< td> 标签的内容应用换行符,除了< a> 标记中。

I want to apply a line-through to the contents of <td> tags except for the <a> tag within a tag. The styles I am applying do not seem to work though... any ideas?

这里是我玩的例子(我在IE8测试):
http://jsfiddle.net/9qbsq/

以下是标记的外观...

Here's what the markup looks like...

HTML

<table border=1>
  <tr class="highlight">
      <td>hello</td>
      <td><a href="#">world</a></td>
  </tr>
  <tr>
      <td>foo</td>
      <td>bar</td>
  </tr>
</table>

CSS

.highlight td { text-decoration:line-through; }
.highlight td a { text-decoration:none; }


推荐答案

span ,并应用 text-decoration:line-through http://jsfiddle.net/9qbsq/1/

这样,当父元素具有 line-through 时,您不必实现删除子元素 line-through $ c>已应用。

That way, you don't have to achieve the impossible task of removing line-through on a child element when a parent element has line-through applied.

这篇关于无法取消嵌套元素的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆