Currently, I am designing a press page for a website where the headlines/articles are displayed in rectangles. To achieve this layout, I am using the following CSS:
.press-blocks{
column-count: 4;
column-gap: 2em;
padding-left: 10%;
padding-right: 10%;
}
.press-item{
display: inline-block;
margin: 0 0 5em;
width: 100%;
text-align: justify;
}
The entire "press" section of the page is enclosed within a single press-blocks
container, and each individual article resides within its own press-item
. This setup allows me to easily maintain chronological order by adding new articles at the top of the page. However, the current layout displays articles in a top to bottom, left to right format like so:
1 5 9 13
2 6 10 14
3 7 11 15
4 8 12 16
I am seeking a solution to adjust the display to read from left to right, top to bottom instead:
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
I have reviewed the W3Schools tutorial on display: inline-block
, and while their example is horizontally oriented, it does not involve a fixed number of columns as mine does. It is important to me that my design maintains exactly 4 columns and expands vertically as new content is added. Additionally, I wish to preserve the consistent vertical spacing between items.
Picture these rectangles evenly distributed with equal horizontal and vertical spaces between them. https://i.sstatic.net/HRLB6.png