2017-10-31 2 views
0

Der Grund, warum ich fragte, war, weil jeder es so macht.SVG-Pfad/Welcher Weg ist richtig?

></path> 

Alle Tutorials zeigen /> ohne </path>

Spotify:

<svg class="icon-play" viewBox="0 0 85 100"><path fill="currentColor" d="M81 44.6c5 3 5 7.8 0 10.8L9 98.7c-5 3-9 .7-9-5V6.3c0-5.7 4-8 9-5l72 43.3z"></path></svg> 

Google:

<svg width="100" height="100" style="background-color:pink;" viewBox="0 0 24 24"> 
    <path fill="currentColor" style="fill:green;" d="M7.995,18.9899999 13.68046871,15.4912499 13.68046871,8.49374997 7.995,4.995 Z M13.6804687,15.4912499 19.3659374,11.99249994 19.3659374,11.99249994 13.6804687,8.49374997 Z"></path> 
    </svg> 

Twitter:

<svg style="fill: currentcolor;color: #1DA1F2;" width="67" height="67" viewBox="0 0 24 24"> 
<circle cx="12" cy="12" r="10"></circle> 
<path fill="white" d="M16.036 11.58l-6-3.82a.5.5 0 0 0-.77.42v7.64a.498.498 0 0 0 .77.419l6-3.817c.145-.092.23-.25.23-.422s-.085-.33-.23-.42z"></path> 
<path fill="green" d="M12 22.75C6.072 22.75 1.25 17.928 1.25 12S6.072 1.25 12 1.25 22.75 6.072 22.75 12 17.928 22.75 12 22.75zm0-20C6.9 2.75 2.75 6.9 2.75 12S6.9 21.25 12 21.25s9.25-4.15 9.25-9.25S17.1 2.75 12 2.75z" ></path> 
</svg> 

YouTube:

<svg width="100" height="100" version="1.1" style="background-color:black;" viewBox="0 0 36 36"> 
<path fill="currentColor" style="fill:#0059dd; "d="M 12,26 18.5,22 18.5,14 12,10 z M 18.5,22 25,18 25,18 18.5,14 z"></path> 
</svg> 

Antwort

1

Weder richtig ist, und weder ist falsch. Beide Wege sind gültig. Verwenden Sie, was Sie bevorzugen.

Offensichtlich, wenn der Pfad Kind Elemente (z. B. <title> oder <animate> dann müssen Sie den End-Tag verwenden. Aber ansonsten ist es egal.