I am making a ludo board using css-grid. If you don't know ludo please see the following image.
In the image only consider the three horizontal rows between the square. I want to do it with grid-template-areas or any other better way. I created 45 <div> for the central horizontal set of rows and wrapped all of those inside a grid container. I have all classes according to the color of cell. Then I gave grid-area of some name to each of the classes and then used that in grid-template-areas. But unfortunately nothing is showing up.
.middle { display: grid; grid-template-columns: repeat(15, 50px); grid-template-rows: repeat(3, 50px); background-color: burlywood; width: 750px; height: 150px; grid-template-areas: "b r b b b b - - - b b b y b b" "r r r r r r - - - y y y y y y" "b b r b b b - - - b b b b y b"; } .b { grid-area: b; height: 50px; width: 50px; background-color: ivory; } .r { height: 50px; width: 50px; grid-area: r; background-color: red; } .y { height: 50px; width: 50px; grid-area: y; background-color: yellow; } .g { height: 50px; width: 50px; grid-area: g; background-color: green; } <div> <div class="middle"> <div class="r"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="b"></div> <div class="r"></div> <div class="r"></div> <div class="r"></div> <div class="r"></div> <div class="r"></div> <div class="r"></div> <div class="r"></div> <div class="g"></div> <div class="g"></div> <div class="g"></div> <div class="g"></div> <div class="y"></div> <div class="y"></div> <div class="y"></div> <div class="y"></div> <div class="y"></div> <div class="y"></div> <div class="y"></div> </div> </div> If I remove grid-area property the cells show up in the order they are placed in html and obviously I can change order of those to get the desired result but I don't want to do it like that. I am looking for some better ways.
