건물, 여러 색상으로 상당히 복잡한 패턴을 구축하기 위해 stroke-dasharray
속성을 사용할 수 있습니다 :
.L4 {
stroke: #000;
stroke-dasharray: 20,10,5,5,5,10;
}
.L5 {
stroke: #AAA;
stroke-dasharray: 0,20,10,15,10,0
}
.L6 {
stroke: #DDD;
stroke-dasharray: 0,35,5,15
}
이 http://jsfiddle.net/colin_young/Y38u9/ 보여주는 라인과 복합 대시 패턴으로 원을 참조하십시오. 함께 업데이트
는
SO 니펫을 :
svg {
width: 100%;
height: 160px;
}
path, circle {
stroke-width: 4;
}
text {
alignment-baseline: central;
font-family: sans-serif;
font-size: 10px;
stroke-width: 0;
fill: #000;
text-anchor: middle;
}
.dim {
stroke: #AAA;
stroke-width: 1;
stroke-dasharray: 1, 1;
}
circle.dim {
fill: #FFF;
}
.L4 {
stroke: #000;
stroke-dasharray: 20, 10, 5, 5, 5, 10;
}
.L5 {
stroke: #AAA;
stroke-dasharray: 0, 20, 10, 15, 10, 0
}
.L6 {
stroke: #DDD;
stroke-dasharray: 0, 35, 5, 15
}
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<g fill="none" stroke="black">
<path class="dim" d="M5 20 l0 80" />
<path class="dim" d="M25 20 l0 80 l-10 20" />
<path class="dim" d="M35 20 l0 80 l-10 30" />
<path class="dim" d="M40 20 l0 120" />
<path class="dim" d="M45 20 l0 80 l10 30" />
<path class="dim" d="M50 20 l0 80 l10 20" />
<path class="dim" d="M60 20 l0 80 l15 10" />
<text x="5" y="110">0</text>
<text x="5" y="125">20</text>
<text x="25" y="135">30</text>
<text x="40" y="150">35</text>
<text x="55" y="140">40</text>
<text x="65" y="125">45</text>
<text x="82" y="115">55</text>
<path class="L4" d="M5 20 l215 0" />
<path class="L5" d="M5 20 l215 0" />
<path class="L6" d="M5 20 l215 0" />
<!-- separated to show composition -->
<text x="5" y="70" style="text-anchor:start">Separated to show composition:</text>
<path class="L4" d="M5 80 l215 0" />
<path class="L5" d="M5 90 l215 0" />
<path class="L6" d="M5 100 l215 0" />
<circle class="L4" cx="400" cy="80" r="60" />
<circle class="L5" cx="400" cy="80" r="60" />
<circle class="L6" cx="400" cy="80" r="60" />
</g>
</svg>
한 가지 방법 : http://www.webdevout.net/test?01v&raw (즉, 다른 뒤에 하나 개의 색상으로, 레이어 하나 개의 요소이다 또 다른 색깔 [점선의 형태로] – reisio
reisio가 지금까지 가장 좋고 안전한 대답 인 것 같습니다. 브라우저가 뭔가 잘못하면 Duopixel의 해결책은 실수에 더 많은 잠재력을 갖고있는 것처럼 보입니다. 당신의 코멘트를 대답으로 바꾸시겠습니까? –