Add calculated height to the grid element.

The grid now has its height set to the sum of heights of its elements.
This fixes broken positioning of elements declared after grid.