I have a Div which contains a few absolutely positioned divs. The clickable area of the top level expands to the area of the children, but the drawn area does not. I want the drawn area to surround all the container divs.
A JSFiddle of the code is here – http://jsfiddle.net/VolatileStorm/C29P8/
After a few refreshes you may notice a small red box in the top left corner (hidden by the divs). This is the container, and I want it to surround the children.
Any ideas? Thankyou.
Seeing as you’ve already got a JS option, I’ll give you one using CSS. It may come across as something of a hack, but it works: http://jsfiddle.net/C29P8/131/
The idea is to remove all positioning elements, set the “.pile” container to
float: left;, which expands it to fit the content (also set the notes tofloat: left;as they have no positioning), and shift the notes, usingmargin-left: -100px;in “.note” andpadding-left: 110px(the extra 10px of padding simply allows for the rotation of the note, keeping it within the red border) in “.pile” so that each note is drawn on top of each other.I’m not brilliant at explaining it, sorry, so I’ve commented the code I’ve added and changed on the JSFiddle page, which should hopefully be clearer.