ul { display: flex; flex-wrap: wrap; li { display: flex; align-items: center; justify-content: center; width: 256px; height: 127px; background-color: #fff; margin-right: 24px; margin-bottom: 12px; img { height: 65px; width: 65px; } &:hover { cursor: pointer; box-shadow: 0px 2px 5px 3px rgba(0,0,0,0.15) ; } } &>li:nth-child(4n){ margin-right: 0; } }