Adapted html and css code to support both the grid and the horizontal scrolling layout