Испытание: сложные палитры [31/31]

.palette-small {
display: flex;
}

.palette-box:first-child .palette-small {
flex-direction: column-reverse;
justify-content: center;
}

.palette-box:first-child .palette-small .color-3 {
align-self: center;
order: 1;
}

.palette-box:first-child .palette-small .color-4 {
align-self: center;
order: -1;
}

.palette-box:nth-child(2) .palette-small {
display: flex;
flex-direction: column-reverse;
justify-content: space-between;
align-items: flex-start;
}

.palette-box:nth-child(2) .palette-small .color-2,
.palette-box:nth-child(2) .palette-small .color-6 {
align-self: flex-end;
}

.palette-box:nth-child(3) .palette-small {
display: flex;
justify-content: space-between;
}

.palette-box:nth-child(3) .palette-small .part {
display: flex;
flex-direction: column;
justify-content: space-between;
}

.palette-box:nth-child(4) .palette-small {
display: flex;
justify-content: space-between;
}

.palette-box:nth-child(4) .palette-small .part {
display: flex;
justify-content: space-between;
}

.palette-box:nth-child(4) .palette-small .part:nth-child(2) {
flex-direction: column-reverse;
justify-content: space-between;
align-items: flex-end;
}

Можно ли как-то оптимизировать код?

.palette-small,
.part {
display: flex;
justify-content: space-between;
}

/* 1 */

.palette-box:first-child .palette-small {
flex-direction: column;
justify-content: center;
}

.palette-box:first-child .color-3 {
order: -2;
}

.palette-box:first-child .color-5 {
order: -1;
}

.palette-box:first-child .color-3,
.palette-box:first-child .color-4 {
align-self: center;
}

/* 2 */

.palette-box:nth-child(2) .palette-small {
flex-direction: column-reverse;
align-items: flex-end;
}

.palette-box:nth-child(2) .color-4,
.palette-box:nth-child(2) .color-1 {
align-self: flex-start;
}

/* 3 */

.palette-box:nth-child(3) .palette-small .part {
flex-direction: column;
}

/* 4 */

.palette-box:nth-child(4) .part:last-child {
flex-direction: column-reverse;
}

1 лайк