Ich schaffe die folgende svg
Element und der Struktur:SVG innen OPTION Element
<svg width="135" height="15">
<rect width="15" height="15" fill="#ffffe5" x="0" y="0"></rect>
<rect width="15" height="15" fill="#f7fcb9" x="15" y="0"></rect>
<rect width="15" height="15" fill="#d9f0a3" x="30" y="0"></rect>
<rect width="15" height="15" fill="#addd8e" x="45" y="0"></rect>
<rect width="15" height="15" fill="#78c679" x="60" y="0"></rect>
<rect width="15" height="15" fill="#41ab5d" x="75" y="0"></rect>
<rect width="15" height="15" fill="#238443" x="90" y="0"></rect>
<rect width="15" height="15" fill="#006837" x="105" y="0"></rect>
<rect width="15" height="15" fill="#004529" x="120" y="0"></rect>
</svg>
, die eine Reihe von kleinen Quadraten erzeugt. Genau wie folgt aus:
Bis jetzt ist alles in Ordnung.
Dann stelle ich den obigen Code innerhalb einer option
für die select
Drop-down, wie unten dargestellt:
<select id="data-color-scheme">
<option id="YlGn">
<div>
<svg width="135" height="15">
<rect width="15" height="15" fill="#ffffe5" x="0" y="0"></rect>
<rect width="15" height="15" fill="#f7fcb9" x="15" y="0"></rect>
<rect width="15" height="15" fill="#d9f0a3" x="30" y="0"></rect>
<rect width="15" height="15" fill="#addd8e" x="45" y="0"></rect>
<rect width="15" height="15" fill="#78c679" x="60" y="0"></rect>
<rect width="15" height="15" fill="#41ab5d" x="75" y="0"></rect>
<rect width="15" height="15" fill="#238443" x="90" y="0"></rect>
<rect width="15" height="15" fill="#006837" x="105" y="0"></rect>
<rect width="15" height="15" fill="#004529" x="120" y="0"></rect>
</svg>
</div>
</option>
</select>
nun der Inhalt der option
als weißes leer angezeigt wird, wie unten im Bild gezeigt :
Wie Sie sehen können, wird der Inhalt des Bildes ist leer. Wenn ich jedoch den Debugging-Inspector ausführe, kann ich dort immer noch das Element svg
erkennen.
Was mache ich falsch? Wie kann ich eine svg
innerhalb einer Option anzeigen? Vielen Dank.
Vielen Dank, aber :( – Greeso