title: Width equal to content
body: <p>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. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>#container {
    width: 30%;
    background-color: grey;
  }
  
  #container p {
    background-color: green;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="container"&gt;
    &lt;p&gt;Sample Text 1&lt;/p&gt;
    &lt;p&gt;Sample Text 2&lt;/p&gt;
    &lt;p&gt;Sample Text 3&lt;/p&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>