My current setup looks like this:
<div id="wrapper">
<div class="column1"></div>
<div class="column3"></div>
<div class="column2"></div>
</div>
#wrapper {
position:absolute;
}
Each of the "column" elements has a distinct width and is styled with float: left
. Collectively, the 3 columns are x pixels wide; however, if I were to add another column, I want the wrapper itself to adjust its width accordingly.
Therefore, I am looking for a way to dynamically calculate and set the width of the wrapper based on the total width of the contained columns using JavaScript.