Skip to content

Commit

Permalink
Centring items in the last row of the grids
Browse files Browse the repository at this point in the history
  • Loading branch information
maheenandcode committed Sep 7, 2023
1 parent 4502dda commit 605ca49
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion people.css
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,39 @@

display: grid;

grid-template-columns: 1fr 1fr 1fr;
/* Creating a 6-column grid with equal fractional widths */

grid-template-columns: repeat(6, 1fr);
grid-template-rows: auto;
grid-gap: 10px;
padding: 10px;

}

/* Targeting all items within the .band container */
.band > div {

/* Spanning each item across 2 grid columns */
grid-column: span 2;
}

/* Dealing with 3n + 2 case where n is the number of rows */

.item-17:last-child:nth-child(3n - 1) {
grid-column-end: -2;
}

.item-16:nth-last-child(2):nth-child(3n + 1) {
grid-column-end: 4;
}

/* Dealing with 3n + 1th item where n is the number of rows */

.item-46:last-child:nth-child(3n - 2) {
grid-column-end: 5;
}


/*formatting for each individual entry*/
.card
{
Expand All @@ -246,6 +272,7 @@
transition: all .1s ease-in;
}


/*Drop shadow and animation on hover*/
.card:hover
{
Expand Down

0 comments on commit 605ca49

Please sign in to comment.