I have a paragraph that contains a span. The <p>
tag's width is much wider than the <span>
it contains, but I would like it to be only as large as its child <span>
.
<p>
<span>Some text.</span>
</p>
I tried width: auto
but that doesn't seem to work.
use display:inline-block;
with p
element.
p{
display:inline-block;
}
Js Fiddle Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With