u[JSON Fetch Request example]
{
text-underline-offset: 3px;
}
<h1><u>JSON Fetch Request example</u></h1>
in above code ,I am unable to offset the underline. but I can choose the a tag as my following code works as per mdn article(ps:i am unable to find mdn article):
a[href="https://cnn.com/"] {
color: red;
}
<a href="https://cnn.com/">cnn</a>
CodePudding user response:
You can add a CSS class to the element. You can also select elements with .querySelector
.
document.querySelector("u").style.color="blue";
.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>