I have to implement a design looking like this:
This will be the index.php page for WordPress and therefore it will be using the WordPress loop to output the blog articles as individual "resources".
Normally I would implement this as a flexbox, because the number of items is variable and I need it to be responsive, however this time our designer has added borders in between the items.
This would be fine but the borders are not included before or after the end of the rows. I cant solve this any of the pseudo selectors that I know of.
Currently my HTML and CSS look something like this:
section {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
section div {
display: flex;
flex-direction: column;
border-right: 1px solid red;
padding-right: 20px;
margin-right: 20px;
margin-bottom: 10px;
}
<section>
<div>
<img class="http://lorempixel.com/output/fashion-q-c-200-200-6.jpg">
<p>
This is some text
</p>
</div>
<div>
<img class="http://lorempixel.com/output/fashion-q-c-200-200-6.jpg">
<p>
This is some text
</p>
</div>
<div>
<img class="http://lorempixel.com/output/fashion-q-c-200-200-6.jpg">
<p>
This is some text
</p>
</div>
<div>
<img class="http://lorempixel.com/output/fashion-q-c-200-200-6.jpg">
<p>
This is some text
</p>
</div>
<div>
<img class="http://lorempixel.com/output/fashion-q-c-200-200-6.jpg">
<p>
This is some text
</p>
</div>
<div>
<img class="http://lorempixel.com/output/fashion-q-c-200-200-6.jpg">
<p>
This is some text
</p>
</div>
<div>
<img class="http://lorempixel.com/output/fashion-q-c-200-200-6.jpg">
<p>
This is some text
</p>
</div>
<div>
<img class="http://lorempixel.com/output/fashion-q-c-200-200-6.jpg">
<p>
This is some text
</p>
</div>
<div>
<img class="http://lorempixel.com/output/fashion-q-c-200-200-6.jpg">
<p>
This is some text
</p>
</div>
<div>
<img class="http://lorempixel.com/output/fashion-q-c-200-200-6.jpg">
<p>
This is some text
</p>
</div>
</section>
Is this something I can solve with CSS grid and is there a way to achieve this using flexbox or another layout that isn't grid?