JSFiddle - React, Tailwind, and code Playground
HTML
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
CSS
ul {
margin: auto;
padding: 0;
font-size: 0;
position: relative;
}
li {
list-style: none;
display: inline-block;
width: 23.5%;
height: 100px;
background: #ccc;
margin-right: 2%;
margin-bottom: 21px;
}
li:nth-child(4n) {
margin-right: 0;
}
li:nth-child(4n):not(:last-child)::before { /* двойные горизонтальные границы */
content: '';
position: absolute;
left: 0;
right: 0;
margin-top: 109px;
border-top: 3px double #ccc;
}
li:not(:nth-child(4n)) {
position: relative;
}
li:not(:nth-child(4n))::before { /* пунктирные вертикальные границы */
content: '';
position: absolute;
top: 0;
bottom: 0;
right: -4.5%;
border-left: 1px dashed #ccc;
}