Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67527

How do I set the background color of targeted text only, using only CSS?

$
0
0

Question

How can I dynamically add a green background behind text, not the entire page width, just the text.

Problem

The green is expanding to the entire page with my current code. I am not able to modify the HTML or Javascript, just the CSS file.

enter image description here

HTML

<h1>The Last Will and Testament of Eric Jones</h1> 

CSS

h1 { 
    text-align: center; 
    background-color: green; 
}

Viewing all articles
Browse latest Browse all 67527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>