Sortable doesn't work well with different sized list items
I'm trying to make a simple "puzzle" with different-sized blocks. There's a base size; also, some blocks are twice as tall, some twice as wide, and some twice both dimensions.
The problem is that, given a layout like the one in the code below, the middle section is left empty, because block 3 extends into the row below it, making the space unusable. Is there a way (WITHOUT absolute positioning) to make blocks slide into that void?
Style:
- .piece {
- clear:none;
- float:left;
- height:195px;
- width:195px;
- border:1px solid white;
- margin:0 3px 3px 0;
- }
- .tallpiece {
- float:left;
- height:395px;
- width:195px;
- border:1px solid white;
- margin:0 3px 3px 0;
- }
- .widepiece {
- float:left;
- height:195px;
- width:395px;
- border:1px solid white;
- margin:0 3px 3px 0;
- }
- .bigpiece {
- float:left;
- height:395px;
- width:395px;
- border:1px solid white;
- margin:0 3px 3px 0;
- }
HTML:
- <ul id="puzzle">
- <li id="0" class="tallpiece">0</li>
- <li id="1" class="widepiece">1</li>
- <li id="2" class="piece">2</li>
- <li id="3" class="bigpiece">3</li>
- <li id="4" class="piece">4</li>
- <li id="5" class="piece">5</li>
- <li id="6" class="piece">6</li>
- <li id="7" class="piece">7</li>
- <li id="8" class="bigpiece">8</li>
- </ul>