Home > database >  cant select values using html u a tags but works for ahref
cant select values using html u a tags but works for ahref

Time:12-13

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>

  • Related