For example, I have some class .article, and I want to view this class as grid view. So I applied this style:
This type of layout is called Masonry layout. Masonry is another grid layout but it will fill out the whitespace caused by the difference height of elements.
jQuery Masonry is one of jQuery plugin to create masonry layout.
Alternatively, you can use CSS3
columns. But for now jQuery based plugin is the best choice since there is compatibility issue with CSS3 column.