Skip to content Skip to sidebar Skip to footer

Is There A Way To Exclude An Html Span From Appearing In Copy-and-paste?

I have a large, multiline body of HTML, resulting from applying an explicit line breaking algorithm to a text string. I'd like to add spans within that HTML to indicate where I've

Solution 1:

No, but CSS Generated content is not copied:

span::after {
  content: "<I won't be copied>";
  display: block;
}
<div>
  Hello<span></span>World!<span></span>Foo<span></span>Bar<span></span>Baz
</div>

Of course, you should only use this for styling purposes, not for content.

Post a Comment for "Is There A Way To Exclude An Html Span From Appearing In Copy-and-paste?"