I have two elements with unknown width, one floated to the left, one to the right. Between them i have a block expanded to fit the container width.
The layout i want to achieve is this:
+---------------------------------------------+
| [Left] [Expanded ] [Right] |
+---------------------------------------------+
But the right-floated element is cleared to the next line:
+---------------------------------------------+
| [Left] [Expanded ] |
| [Right] |
+---------------------------------------------+
It works fine if the elements are in this order in the HTML: Left, Right, Expanded.
But to be more semantic, i need this order: Left, Expanded, Right.
See this jsFiddle.
Is it possible? Even if wrappers are needed…
You can do it using
display: table: http://jsfiddle.net/thirtydot/GpL5A/3/HTML:
CSS:
A small downside of this technique is that the dying browser IE7 does not support
display: table, though there is a JavaScript fix.