Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add a border to an (8 point star) css shape?

How do I add a red border outside this 8 point star? Or is there a simple svg solution anyone knows of?

IS: enter image description here NEED: enter image description here

JS fiddle

HTML

<div id="star8"></div>

CSS

#star8 {
 border: 3px solid red;
 background: blue; width: 80px;
 height: 80px;
 position: relative;
 -webkit-transform: rotate(20deg);
 -moz-transform: rotate(20deg);
 -ms-transform: rotate(20deg);
 -o-transform: rotate(20eg);
 }
#star8:before {
 content: "";
 position: absolute;
 top: 0;
 left: 0;
 height: 80px;
 width: 80px;
 background: blue;
 -webkit-transform: rotate(135deg);
 -moz-transform: rotate(135deg);
 -ms-transform: rotate(135deg);
 -o-transform: rotate(135deg);
 }
like image 357
Patrick Avatar asked Dec 06 '22 19:12

Patrick


1 Answers

SVG solution

This can be created with a single svg path. Adding outline can be done with adding a stroke property to the path

<svg viewBox="-1 -1 50 50" width="200px">
  <path d="M 35,40 30,48 21,42 11,44 9,34 0,30 6,20 4,10 14,8 20,0 28,5 38,3 l 1,10 8,5 -5,8 2,10z" stroke="red" stroke-linejoin="bevel" fill="black" />
</svg>
like image 75
Persijn Avatar answered Dec 24 '22 00:12

Persijn