[Codepen] (https://codepen.io/shaswatatripathy/pen/oNgPpyd)
HTML
<rect x="0.5" y="0.5" width="50" height="50" class="topBottom"/>
<rect x="70.5" y="0.5" width="50" height="50" class="left"/>
<rect x="140.5" y="0.5" width="50" height="50" class="topRight"/>
<rect x="200.5" y="0.5" width="50" height="50" class="top"/>
<rect x="260.5" y="0.5" width="50" height="50" class="bottomLeft"/>
<rect x="320.5" y="0.5" width="50" height="50" class="bottomRight"/>
<rect x="380.5" y="0.5" width="50" height="50" class="topLeft"/>
<rect x="440.5" y="0.5" width="50" height="50" class="right"/>
<rect x="500.5" y="0.5" width="50" height="50" class="bottom"/>
<rect x="560.5" y="0.5" width="50" height="50" class="leftRight"/>
</svg>
CSS
rect { fill: none; stroke: black; }
.topBottom { stroke-dasharray: 50 }
.leftRight { stroke-dasharray: 0,50,50,0 }
.bottomLeft { stroke-dasharray: 0,100,150 }
.bottomRight { stroke-dasharray: 0,50,50 }
.topRight { stroke-dasharray: 100 }
.topLeft { stroke-dasharray: 50,100 }
.left { stroke-dasharray: 0,150,50 }
.top { stroke-dasharray: 50,150 }
.bottom { stroke-dasharray: 0,100,50,100 }
.right { stroke-dasharray: 0,50, 50,50 }