I
I
Islam Ibakaev2017-07-01 01:00:13
css
Islam Ibakaev, 2017-07-01 01:00:13

Should I specify cell height in masonry grid?

I want to use masonry for a grid of advertising banners
e2dc635bed6d4685a8ff4a4a7f911ef6.png
. I will set the width of the cells through percentages. there is an example in the docs

.grid-sizer,
.grid-item { width: 20%; }
/* 2 columns wide */
.grid-item--width2 { width: 40%; }

About the height. Do I understand correctly that it must be specified directly in the rule for the cell:
.grid-item {
  height: 295px;
}

.grid-item--height2 {
  height: 590px;
}

Or is it better to let the content inside the cell define its height? What is the best approach?
UPDATED: in the official example, the author writes the height directly in the rules for the cell. Does he do this purely because he has empty cells in the example (in a real example there will be content) or does he recommend this approach?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question