For example, there is such a construction:
div{ width:300px; } p span{ background:#cc0000; padding:0 10px; border-radius:8px; word-wrap:break-word; color:#cc0000; } ::selection{ color:transparent; background:transparent; } ::-webkit-selection{ color:transparent; background:transparent; } ::-moz-selection{ color:transparent; background:transparent; } p{ line-height:22px; }
<div> <p> <span> Praesent </span><span>sapien</span> <span>massa,</span> <span>convallis</span><span> a pellentesque</span> <span>nec,</span><span> egestas non nisi. </span><span>Vestibulum</span><span> ac diam </span><span>sit amet quam</span> <span>vehicula</span><span> elementum sed</span><span> sit amet dui.</span><span> Praesent sapien</span> <span>massa, convallis</span><span> a </span><span>pellentesque nec,</span><span> egestas non nisi.</span> </p> </div>
But if you put each word in the <p></p>
without <span></span>
then personally I don’t have anything, that is, you need to make each word not visible as in the example above, but at the same time that the text was located just in the <p></p>
. How to achieve the same without nested <span></span>
?