How do I generate square map (stacking squares within a specific shape)

I would like to generate squares within borders of a specific shape (Croatia). This is an example.

I was thinking about using image maps to generate square in such shape. Squares of image maps are transparent and I cannot fill them with colors or images.

I was searching around but I can’t find something similar. I was thinking about stacking divs next to each other but it could be even more hard since they need to create a shape of Croatia and never break formation.

Do you have any other idea that might work?

Well, your problem mostly is going to be ‘how do i get a bunch of squares to look like the border of croatia’?

Do the squares need to be divs? What about <rect>'s inside of an SVG? Those are pretty easy to draw wherever your mathematical heart desires…

No need to be divs. There are no limitations how to make it. Any ideas are welcome. If can be adjustable, such as addding image background to it

Well it very much sounds like you’re describing an SVG or canvas drawing.