Match the width of another div which uses width:auto; and then add x amount to it

irabogota

New Member
Is there anyway I can make a div match the width of another div, when the other div uses width:auto; and is changed dynamically depending on the content. Then add an extra amount of pixels to the width.For example...jsFiddleHTML\[code\]<div id="div1"> <div id="filler"></div> <div id="filler"></div> <div id="filler"></div></div><div id="div2"></div>\[/code\]CSS\[code\]#div1 { position:absolute; height:100px; width:auto; min-width:100px; background-color:blue; padding-right:10px;}#div2 { position:absolute; height:100px; min-width:100px; top:150px; background-color:red;}#filler { position:relative; height:80px; width:80px; top:10px; margin-left:10px; background-color:yellow; float:left;}\[/code\]How can I make div2 match the width of div1 and then add 100px to it? So that no matter how many filler divs I put into div 1, div 2 will always be the same width +100?Like...(div2 width) = (div1 width) + 100I suspect that Jquery will be involved somehow so I've added it to my tags.
 
Back
Top