2010-04-27 82 views

回答

10

這裏是你想要的Styling Dropdown Lists

<style type="text/css"> 
 
    option.red {background-color: #cc0000; font-weight: bold; font-size: 12px;} 
 
    option.pink {background-color: #ffcccc;} 
 
    </style> 
 

 
    <select name=colors> 
 
    <option class="red" value= "../getting_started/">Getting Started </option> 
 
    <option class="pink" value= "../getting_started/html_intro1.htm">- Intro to HTML 
 
    </option> 
 
    </select>

+0

使用class和id的選項標籤,如果我從一個列表以這種方式填充下拉列表什麼: 「@Html。 DropDownListFor(m => m.ModActionCatList,actionCatList,new {@class =「select2-select-00 col-md-12 full-width-fix required」...' – 2014-12-08 13:35:16

+0

也許有人可以幫忙澄清一些混亂,我看了我只是測試了這個,即使你刪除了'tyle'讓第一行讀取'