I have an ul, inside it has 3 li, inside one of these li has an image, I would like to know if it has a method via css to make the width of ul is equal to width of the image. (without changing the width of the image) I want to do this because the texts end up with a wider width than the image and I can not change the size of the image
<ul>
<li><p>Texto texto texto</p></li>
<li><img src="qualquer-img.png" alt="qualquer img"></li>
<li><p>Texto texto texto texto texto texto texto texto texto texto texto</p></li>
</ul>