2016-02-12 48 views
0

這是默認的風格,當我的單選按鈕激活:enter image description here設置背景單選按鈕時主動

,這就是我想要活躍的時候:enter image description here

任何想法去做,在CSS?

+0

你有變化,整個元素。你不能只改變背景顏色。 –

+1

http://code.stephenmorley.org/html-and-css/styling-checkboxes-and-radio-buttons/ ...在Google上尋找它2秒。如果你花時間搜索,你可能會發現你需要的東西 – r4phG

+0

我現在看到了,謝謝 –

回答

0

要使用自定義樣式的表單元素,我可以推薦使用uniform。 雖然它需要一些jquery,但一旦安裝它對於所有表單元素都非常流暢。

$('input[type="radio"]').uniform(); 

自定義CSS

input[type="radio"] { visibility: hidden; } 
.radio span { 
    background-image: url(http://path-to-unchecked.png); 
    background-repeat: no-repeat; 
} 
.radio span.checked { background-image: url(http://path-to-checked.png); } 

該腳本將環繞所有目標領域的一些額外的HTML。如果你想要一個只有CSS的解決方案,這將是相同的要求。

DEMO