INFO + FRAGE + ANTWORT
Ausgewählt: INFO Nr. 1111
zum Thema
MULTIMEDIA WEBDESIGN HTML ERWEITERUNGEN SVG
Stichwörter: HTML, Erweiterungen, SVG (Scalable Vector Graphics), Pfad - <path... />, Linie horizontal, Linie vertikal
Inhalt: cadat info Pfad - <path... />, Linie horizontal, Linie vertikal
Mit dem Tag <path... /> kann in SVG ein Pfad (path) u.a. mit einfachen Angaben eine horizontale oder vertikale Linie gezeichnet werden. Außer dem Startpunkt muß bei der horizontalen .Linie nur die X-Kordinate des Endpunktes und bei der vertikalen Linie die Y-Koordinate des Endpunktes eingegeben werden. Die Endpunkte können in relativen oder absoluten Koordinaten angegeben werden. Der Koordinaten des Startpunkts M oder m werden immer als absolute Koordinaten interpretiert. Außerdem sind noch die Farbe der Linie und die Linienbreite anzugeben.

[1] horizontale Linie: <path d="Mx1 y1 Hx2" ... />
Es wird eine horizontale Linie vom [2] Startpunkt M bis zum [3] Endpunkt H oder h gzeichnet.

[4] vertikale Linie: <path d="Mx1 y1 Vy2" ... />
Es wird eine vertikale Linie vom Startpunkt M bis zum Endpunkt V oder v gzeichnet
Anzugeben ist in absoluten oder relativen Koordinaten:
siehe auch -> Pfad - <path... />, Übersicht
siehe auch -> Linie - <line... />
Beispiele: <svg width="1000" height="1000" fill="black">
<path d="M0 100 H200" stroke="blue" stroke-width="2"/>
<!-- Beispiel 1: 2 Pixel breite, blaue, horizontale Linie wird vom Startpunkt M zum Endpunkt H gezeichnet, absolute X-Koordinate = 200 -->
<path d="M100 0 V200" stroke="#f336ff" stroke-width="5"/>
<!-- Beispiel 2: 5 Pixel breite, pinke, vertikale Linie wird vom Startpunkt M zum Endpunkt V gezeichnet, absolute Y-Koordinate = 200 -->
<path d="m20 80 h200" stroke="#ffac36" stroke-width="5"/>
<!-- Beispiel 3: 5 Pixel breite, orange, horizontale Linie wird vom Startpunkt M zum Endpunkt h gezeichnet, relative X-Koordinate = 200 | absolute X-Koordinate = 220 -->
<path d="m120 20 v200" stroke="green" stroke-width="10"/>
<!-- Beispiel 4: 10 Pixel breite, grüne, vertikale Linie wird vom Startpunkt M zum Endpunkt v gezeichnet, relative Y-Koordinate = 200 | absolute Y-Koordinate = 220 -->
<!-- Die neue gezeichneten Linien liegen über der den vorher gezeichneten Linien -->
</svg>
??? FRAGE Nr. 1230
zum Thema
MULTIMEDIA WEBDESIGN HTML ERWEITERUNGEN SVG
Frage: Welcher HTML-Code ist richtig, um in SVG mit dem Tag <path .../> eine 200 Pixel lange horizontale Linie, deren Endpunkt die absolute X-Koordinate 220 hat, zu zeichen?
  Welche Antwort / Antworten ist / sind richtig? (Mindestens 1 Antwort ist, maximal 6 Antworten sind richtig)
  <path d="M20 100 H220" stroke="blue" stroke-width="2"/>
  <path d="m0 100 h200" stroke="blue" stroke-width="2"/>
  <path d="M20 100 h200" stroke="blue" stroke-width="2"/>
  <path d="M220 100 H20" stroke="blue" stroke-width="2"/>
  <path d="H220 M20 100" stroke="blue" stroke-width="2"/>
  <line x1="20" y1="100" x2="220" y2="100" stroke="blue" stroke-width="2" />
  max. 3 Punkte