css 无法使用html u a标记选择值,但可用于ahref

kcwpcxri  于 2022-12-15  发布在  其他
关注(0)|答案(1)|浏览(101)
u[JSON Fetch Request example]
{
    text-underline-offset: 3px;
}
<h1><u>JSON Fetch Request example</u></h1>

在上面的代码中,我无法偏移下划线.但我可以选择a标签,因为我下面的代码按照mdn文章工作(ps:我无法找到mdn文章):
一个二个一个一个

anauzrmj

anauzrmj1#

你可以给元素添加一个CSS类,也可以用.querySelector来选择元素。

.r{
  color: red;
}
<p>This is a <u>test</u> of the selection of u elements w JavaScript.</p>

<p>This is a <u class=r>test</u> of the selection of u elements w/o JavaScript.</p>

相关问题