html - 如何在不使用 style 属性的情况下从已应用于其父级的 css 属性中排除某些元素

标签 html css

我的表是自动生成的,所以我不能给它上课。我所能做的就是像下面这样的白色通用 css

td{white-space:nowrap}
a{white-space:normal}

我怎样才能给 text1 正常的空白空间,但为文本 2 和文本 3 换行?

<tr>
<td>
<a href=""...>text 1</a>
</td>
<td>
text 2
</td>
<td>
text3
</td
</tr>

最佳答案

td { white-space:nowrap; }
td a { white-space:normal; }

记得要有

td a {..}

之后

td {..}

关于html - 如何在不使用 style 属性的情况下从已应用于其父级的 css 属性中排除某些元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10833216/

相关文章:

javascript - 如何在javascript中的匹配函数中传递变量?

html - 如果一次隐藏一个 block ,我们可以对页面中的不同 block 使用相同的 id

html - 谷歌地图弄乱了我的页面 :)

javascript - 平滑的导航菜单将整个页面滚动到顶部

javascript - 无法选择单选按钮

html - 盒子内 CSS 中的三 Angular 形

javascript - 刷新时维护表单元素状态

html - 堆叠相对位置 div 类

javascript - 我的函数只是用实体名称替换其中两个字符?

javascript - 如何隐藏按钮并使其在隐藏时占用空间?