How do I set a background-color for the width of text, not the width of the entire element, using CSS?

What I want is for the green background to be just behind the text, not to be 100% of the page width. Here is my current code:

h1 { 
    text-align: center; 
    background-color: green; 
}
<h1>The Last Will and Testament of Eric Jones</h1> 

16 Answers
16

Leave a Comment