Hugo
Hugo

Reputation: 13

"text-decoration: none" not working, even with "!important"

When I try to use something like underline it works, but none does not, even with !important. Does anyone know why?

PS: The del element should stay with the line, I'm trying to remove the line from this new after content.

del:after {
  content: attr(datetime);
  text-decoration: none !important;
}
<del datetime="2001-01-01">Text</del>

Upvotes: 1

Views: 637

Answers (1)

Jesse Kernaghan
Jesse Kernaghan

Reputation: 4634

You need to target the <del> element itself rather than the :after pseudo element.

** Edit **

Updated upon further instruction. This code will remove the text-decoration from the pseudo, but not the rest. The key was adding display: inline-block;.

del:after {
  display: inline-block;
  content: attr(datetime);
  text-decoration: none;
}
<del datetime="2001-01-01">Text</del>

Upvotes: 1

Related Questions