<table>
<tr>
<td>Hello StackOverFlow</td>
</tr>
</table>
嗨!我是 html 新手,谁能告诉我 td 标签 中的“Hello StackOverFlow”一词是什么类型的元素?是标签吗?
最佳答案
<td>
里面的元素tag 是一个文本节点。你不能在 CSS 中解决它。如果你想设置它的样式,你要么必须设置 <td>
的样式。用 <span>
标记或围绕您要设置样式的文本元素。
因此,例如,仅设置 Hello
的样式:
<table>
<tr>
<td><span>Hello<span> StackOverFlow</td>
</tr>
</table>
在你的 CSS 中
span { font-weight: bold; }
或者您想要赋予它的任何样式。
另请参阅 this related question 的答案.
关于javascript - td 标签内的元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29765724/