Take a look at http://jsfiddle.net/gjQVW/4/
<div class="container"> <div>left</div> <div>right</div> </div>
With these styles
.container {display: table; width: 100%; margin-left: 0; margin-right: 0; margin-top: 3em; background: red} .container > DIV {border: 1px dashed red; display: table-cell; width: 1%; border-left: 0.5em solid black; border-right: 0.5em solid red; background: yellow} .container > DIV:first-child {background: pink; border-left: 1px solid lime} .container > DIV:last-child {background: teal; border-right: 1px solid yellow}
Using display: table and table-cell , you can have both columns with the same height and make sure they are next to each other. You can also add multiple columns or just leave 1. You may need to adjust width: 1% . For only two columns, 50% should be enough, but as you add columns, you should start lowering it so that the columns are the same, etc. You can also use padding for the separator, but margin and table-cell don "ok."
Also note that :last-child css selector is not supported in IE 8, and you will need to use a class or identifier in the DIVs column.
EDIT: Added another fiddle to cover the DIV, which should be in the middle, since it needs to hold somecontent
http://jsfiddle.net/frozenkoi/RfzWb/ HTML:
<div class="mightyContainer"> <div class="container3"> <div>lefty<br><br><br>more lefty</div> <div class="divider">i</div> <div>right</div> </div> </div>
CSS
.mightyContainer {position: relative; background: magenta; margin-top: 3em} .container3 {display: table; width: 100%; margin-left: 0; margin-right: 0; background: red; -k-position: relative} .container3 > DIV {border: 1px dashed red; display: table-cell; width: 50%; border-left: 0.5em solid yellow; border-right: 0.5em solid black; background: yellow} .container3 > DIV:first-child {background: pink; border-left: 1px solid lime} .container3 > DIV:last-child {background: teal; border-right: 1px solid yellow} .container3 .divider {text-align: center; width: 1em; background: lime; border: none; opacity: 0.5; display: block; position: absolute; top: 0px; bottom: 0px; left: 50%; margin-left: -0.5em; ; }
The separator is positioned in the middle with absolute positioning. Note that an extra DIV with the mightyContainer class mightyContainer necessary because in FireFox, a div with the divider class uses the entire page as a parent for positioning instead of conteiner3 . RockMelt (webkit) and IE 8/9 didn't seem to need this if you move styles from .mightyContainer to .container3 and remove the mightyContainer DIV (for an example of how FireFox behaves without this extra DIV, see http: // jsfiddle.net/frozenkoi/3zhsv/ ).
source share