如何更改单选按钮的默认外观,而不是功能?
在表单上,我有两个单选按钮是和否。我要更改单选按钮的默认外观
On a form I've two radio button Yes and No. I want to change the default look of radio buttons
喜欢这个。
>
修改:我想将收音机
按钮更改为< a> ;
I would like to change the radio
buttons into <a>
anchor when JavaScript is enabled if it's not easy to change the look of default radio via css.
<input type="radio" name="radio[1]" /><label for="radio[1]"><img src="/yes.png"></label>
<input type="radio" name="radio[2]" /><label for="radio[2]"><img src="/no.png"></label>
p.s。这使用内置的HTML功能,无处不在,不需要javascript。使用一些CSS元选择器(:hover等...)添加动画。
p.s. This uses built in HTML functionality that works everywhere and doesn't require javascript. Use some CSS meta selectors (:hover etc...) to add animation.
更新:
经过漫长的时间循环回来,意识到这可以做一些更多的解释初学者。当在标签上设置了属性时,点击标签在功能上与点击元素
为
属性相同指着。为完整起见,属性的
应设置为表单元素的
id
。
Just looping back after a long time and realised this could do with a little more explanation for beginners. When the for
attribute is set on a label, clicking the label is functionally the same as clicking the element it's for
attribute points to. For completeness, the for
attribute should be set to the id
of the form element.