I'm experiencing some trouble with the width property of CSS. I have some paragraphs inside a div. I'd like to make the width of the paragraphs equal to their content, so that their green background looks like a label for the text. What I get instead is that the paragraphs inherit the width of the div father node which is wider.
#container {
  width: 30%;
  background-color: grey;
}
#container p {
  background-color: green;
}<div id="container">
  <p>Sample Text 1</p>
  <p>Sample Text 2</p>
  <p>Sample Text 3</p>
</div> 
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    