Background color for a text
<p>i'm trying to give background to a text in html but i'm stuck. </p>

<p>i've tried the code below:</p>

<pre><code>&lt;p&gt;&lt;span style="background-color: #000;color:#fff;"&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt bibendum ligula, ac pulvinar justo scelerisque in. Ut nec auctor urna.&lt;/span&gt;&lt;/p&gt;
</code></pre>

<p>result is:</p>

<p><a href="https://i.stack.imgur.com/LNIvg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LNIvg.png" alt="first result"></a></p>

<p>that is what i want to do (like selected-text):</p>

<p><a href="https://i.stack.imgur.com/znsHZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/znsHZ.png" alt="want to do"></a></p>

<p>don't know how to do that. any helps would be great.</p>

<p>thanks!</p>