How can I make a div not larger than its contents? August 26, 2022 by Tarik The solution is to set your div to display: inline-block.