如何为单选按钮提供 css 样式 [英] How to give css style to Radio button
本文介绍了如何为单选按钮提供 css 样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为单选按钮赋予css样式,并且应该也适用于Mac、safari和Chrome
how to give css style to Radio button, and should work on Mac, safari and Chrome too
<form action="">
<input type="radio" name="gender" value="male"> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
</form>
推荐答案
您可以将其写入 CSS 文件.
You could write this into your CSS-File.
input[type="radio"] {
... your declarations here ...
}
这是您的收音机的选择器.
This is the selector for your radios.
注意:这也会影响您站点上的其他收音机.如果你用 div
或其他标签包裹你的收音机并给标签一个特定的 id
会更好.然后你可以像这样选择 id 中的收音机:
NOTE:
This will affect other radios on your site too. It would be better if you wrap your radios with a div
or other tags and give the tag a specific id
. Then you could select the radios inside the id like this:
#yourDivId input[type="radio"] {
... your declarations here ...
}
这篇关于如何为单选按钮提供 css 样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文