I'm trying to place two div's beside each other with the following criteria:
- Both divs must stay on the same line.
- Priority must be given to the left div. As much text as possible should be displayed in the left div up to the point where ellipsis is used in case of overflow.
- The right div's text should be right aligned. In the case of overflow, ellipsis should be used.
- Text is dynamic, so no percentages or fixed widths can be used.
- Only needs to work on
webkit
based browser, soCSS3
solution is preferred.
Here are some sample images of how it would look:
Input
<div class='left'>I should always fit. If not, ellipsis should be used.</div><div class='right'>Right align and fit me if space available here.</div>
Output
Input
<div class='left'>I should always fit. If not, ellipsis should be used. And some more text and more, and more text.</div><div class='right'>Right align and fit me if space available here.</div>
Output
Input
<div class='left'>This text is left aligned.</div><div class='right'>This text is right aligned.</div>
Output