To accomplish this task, you have a few options at your disposal. Firstly, you can employ either display: inline-block;
or float: left;
to align the divs next to each other. It's important to note that these two methods function differently, so choose the one that best suits your specific scenario.
Secondly, it's crucial to ensure that the containing div (a) is sufficiently wide to accommodate both divs on the same line. Alternatively, applying overflow: hidden;
to the containing div (a) can also achieve the desired result.
Edit:
I have made adjustments to your provided example: http://jsfiddle.net/uVqG6/11/
In this case, I utilized white-space: nowrap;
since the inner divs were wrapping unexpectedly.
For additional insights related to your query, you may find the following resource helpful: CSS: how to stop text from taking up more than 1 line?
Furthermore, keep in mind that when utilizing display: inline-block
, the element is treated akin to text, meaning that most text-formatting CSS properties will be applicable to it.