Last Updated: February 25, 2016
· acheloos

Avoid Whitespace in Foundation Blockgrid when hiding Elements

So, if you're working with foundation and use the blockgrid and dynamically hide and show elements, with more than one row you will get whitespace - ugly!



via js will hide element, but if there are say 2 rows and you hide last of row 1 there will be whitespace.
This is a result of how foundation calculates (or more precisely counts) the elements <li>.

Now the Tip:
If you don't care about the elements order, simply do the following to every element you hide:


This will simply put the selected element to the end of your ul container, producing a nice and clean flow of your blockgrid elements without whitespace.

Example of the Problem:

Stackoverflow thread on reordering lists: