Text inserted via ::before
and ::after
cannot be selected and not copied.
How can I change this?
span::before {
content: "including this text";
}
<p>
If the text of this paragraph is selected and copied then all of it should be copied
<span>instead of only this part</span>.
</p>
Using JavaScript instead of CSS is not acceptable. But the following JavaScript would be a acceptable:
- a function taking an element and returning the
::before
text. - a function taking an element and sitting its
:: before
text todisplay:none
.