I read meanwhile that the solution with column-count seems to be originally made for newspaper-style columns [1], meaning first from top to bottom and only then from left to right. So I entirely changed the phocagallery-masonry.css to this grid scheme:
Code: Select all
.pg-masonry {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-column-gap: 5px;
grid-row-gap: 5px;
justify-content: center;
}
.pg-masonry figure {
}
.pg-masonry-item {
margin: 0px;
}
.pg-masonry-item img{max-width:100%;}
@media only screen and (max-width: 320px) {
.pg-masonry {
/*all: initial; */
grid-template-columns: repeat(1, 1fr);
grid-column-gap: 3px;
grid-row-gap: 3px;
justify-content: center;
}
}
@media only screen and (min-width: 321px) and (max-width: 768px){
.pg-masonry {
/*all: initial; */
grid-template-columns: repeat(2, 1fr);
grid-column-gap: 3px;
grid-row-gap: 3px;
justify-content: center;
}
}
@media only screen and (min-width: 769px) and (max-width: 1200px){
.pg-masonry {
/*all: initial; */
grid-template-columns: repeat(4, 1fr);
grid-column-gap: 4px;
grid-row-gap: 4px;
justify-content: center;
}
}
@media only screen and (min-width: 1201px) {
.pg-masonry {
/*all: initial; */
grid-template-columns: repeat(4, 1fr);
grid-column-gap: 5px;
grid-row-gap: 5px;
justify-content: center;
}
}
Code: Select all
div.pg-masonry-item > figure {
margin: 0 0 0;
}
Still -- with this solution the justify-content: center; is ignored, and I don't know why.
Also, when there is more space availabe than given in grid-column-gap, the white space between gets more and more and it again looks ugly because of too much white space between the columns. But anyhow, at least the order-problem from above is solved
And I'm really sorry that this homepage steadily changes, because this is already our test-server where we try to improve things. So I would need to make a test-server of the test-server which is at the moment not possible :-/
[1] https://forum.joomla.org/viewtopic.php?t=987508