JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://code.jquery.com/jquery-3.2.1.js"></script>
<p>This is the original text. This is the original text. This is the original text. This is the original text. This is the original text. <span class="changeText">This text has
changed. This text has changed. This text has changed.</span> This is the original text.This is the original text. This is the original text. This is the original text. This is the original text.This is the original text.This is the original text. This
is the original text. This is the original text. This is the original text. <span class="changeText">This text has
changed. This text has changed. This text has changed.</span> This is the original text.This is the original text.This is the original text. This is the original text. This is the original text. This is the original text.This is the original text.This
is the original text. This is the original text. This is the original text. This is the original text.This is the original text.This is the original text. This is the original text. This is the original text. This is the original text.
</p>
CSS
p {
margin-left: 200px;
}
.changeText {
background-color: yellow
}
.changeText:before {
position: absolute;
left: 50px;
background-color: black;
content: " ";
width: 10px;
height: 1em;
}
JavaScript
//$(".changeText:before").css("height": $(this).closest(".changeText").height() + "px");