Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You cannot set the font of the <code>&lt;option&gt;</code> tag but you could create a list with specific styles (as you would expect)</p> <p>Here's everything I've been trying:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$("select.js option:eq(0), ul li:eq(0)").css("fontFamily", "tangerine"); $("select.js option:eq(1), ul li:eq(1)").css("fontFamily", "tahoma"); $("select.js option:eq(2), ul li:eq(2)").css("fontFamily", "times new roman");</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>h1 { font-size: 1.2em; margin-top: 10px; color: #777; } .tangerine { font-family: tangerine; } .tahoma { font-family: tahoma; } .timesnewroman { font-family: times new roman; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"&gt;&lt;/script&gt; &lt;h1&gt;Set with jQuery&lt;/h2&gt; &lt;select id="js"&gt; &lt;option&gt;Tangerine&lt;/option&gt; &lt;option&gt;Tahoma&lt;/option&gt; &lt;option&gt;Times New Roman&lt;/option&gt; &lt;/select&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;h1&gt;Set with CSS&lt;/h2&gt; &lt;select id="css"&gt; &lt;option class="tangerine"&gt;Tangerine&lt;/option&gt; &lt;option class="tahoma"&gt;Tahoma&lt;/option&gt; &lt;option class="timesnewroman"&gt;Times New Roman&lt;/option&gt; &lt;/select&gt; &lt;div&gt;&amp;nbsp;&lt;/div&gt; &lt;h1&gt;List&lt;/h2&gt; &lt;ul&gt; &lt;li&gt;Tangerine&lt;/li&gt; &lt;li&gt;Tahoma&lt;/li&gt; &lt;li&gt;Times New Roman&lt;/li&gt; &lt;/ul&gt;</code></pre> </div> </div> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload