将svg文件添加到选项标记中

时间:2015-09-28 08:08:46

标签: html svg

我有一个像这样的选项标签

<option value="change" data-unit="{{ currency_string }}">{{ currency_string|upper }}<option>

但是我想将我的货币字符串添加为它的特定符号,所以我想在其中集成svg文件。通常我使用的是fontello.css所以我正在使用

<span class="iconname">

直接但是对于选项标签我不能。

有人可以告诉我如何整合它?

1 个答案:

答案 0 :(得分:1)

对我来说,我可以添加“font-ello”字体就好了 请注意,我使用的cdn和url在浏览器与浏览器之间会有很大差异 这只是一个测试,适用于firefox 你如何包含字体可能存在问题。

@font-face {
  font-family: 'entypo';
  src: url('https://cdn.jsdelivr.net/entypo-fontello/0.1/entypo.eot');
  src: url('https://cdn.jsdelivr.net/entypo-fontello/0.1/entypo.eot?#iefix') format('embedded-opentype'), url('https://cdn.jsdelivr.net/entypo-fontello/0.1/entypo.woff') format('woff'), url('https://cdn.jsdelivr.net/entypo-fontello/0.1/entypo.ttf') format('truetype'), url('https://cdn.jsdelivr.net/entypo-fontello/0.1/entypo.svg#entypo') format('svg');
  font-weight: normal;
  font-style: normal;
}
.entypo {
  font-family: 'entypo';
  font-size: 2em;
  font-weight: normal;
  line-height: 0;
}
<span>span elements</span>
<p>without font-ello</p>
<span class=""></span>
<p>with font-ello</p>
<br>
<br/>
<span class="entypo"></span>
<p>option fontello</p>
<select>
  <option class="entypo"></option>
  <option class="entypo"></option>
</select>
<p>nofontello</p>
<select>
  <option class=""></option>
  <option class=""></option>
</select>