Here is one fixed-width approach. The gap between the two columns will be equal to the width of the main div.
Fiddle
<div class="container"> <div class="sides">The big text here.<div> <div class="main"></div> </div>
For variable widths, you need JS or jQuery.
Update:
I used jQuery for this purpose, since I found that pure JS is hard to find a solution to this.
function setGap() { var width = $(".main").width(); $(".sides").css({ "-moz-column-gap": width + "px", "-webkit-column-gap": width + "px", "column-gap": width + "px" }); } $(window).resize(setGap); setGap();
Fiddle
Update 1:
function setGap() { var width = document.getElementsByClassName("main")[0].offsetWidth; var elem = document.getElementsByClassName("sides")[0]; var style = elem.getAttribute("style"); if (typeof style != "null") { style = "-moz-column-gap:" + width + "px; -webkit-column-gap:" + width + "px; column-gap:" + width + "px"; elem.setAttribute("style", style); } else { style += "-moz-column-gap:" + width + "px; -webkit-column-gap:" + width + "px; column-gap:" + width + "px"; elem.setAttribute("style", style); } } window.onresize = setGap; setGap();
Fiddle
source share