I would like to know if there's a way so you can make a div have the width and the height of its contents, no mater what?

So far I have tried with several css rules but nothing seems to be working.

Thanks.