My webpage features two div blocks that are set to a default width of 900px each. To make them adjust their width according to the text content, I used
float: left; or display: inline-block;
This caused the divs to resize based on the size of the text, but the second div ended up overlapping the first one horizontally. By the way, my page consists of questions and answers, with each question being in its own div and followed by an answer.