$width: 40px; $height: 40px; $dark: #000; $light: #FFF; .container { width: 100%; position: absolute; top: 0; bottom: 0; display: -webkit-flex; display: flex; align-items: center; justify-content: center; } .content { width: 13*$width; height: 13*$width; position: relative; } .content:hover { .diag1:before, .diag1:after, .diag2:before, .diag2:after, .up:before, .up:after, .left:before, .left:after, .right:before, .right:after, .down:before, .down:after { display: none; } } .box { width: $width; height: $height; background: $dark; padding: 0; margin: 0; float:left; position: relative; } $minibox: 0.25 * $width; @mixin littlebox { width: $minibox; height: $minibox; position: absolute; content: ""; margin: 0.05 * $width; border-radius: 0px; background: $light; } @mixin lower-left { @include littlebox; bottom: 0; left: 0; } @mixin lower-right { @include littlebox; bottom: 0; right: 0; } @mixin upper-right { @include littlebox; top: 0; right: 0; } @mixin upper-left { @include littlebox; top: 0; left: 0; } .down:before, .diag1:before, .left:before { @include lower-left; } .down:after, .right:before, .diag2:after { @include lower-right; } .right:after, .up:after, .diag1:after { @include upper-right; } .left:after, .up:before, .diag2:before { @include upper-left; } // Alternating the colors. .box:nth-child(2n) { background: $light; } .box:nth-child(2n):after, .box:nth-child(2n):before { background: $dark; }