Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 为收音机添加背景_Html_Css - Fatal编程技术网

Html 为收音机添加背景

Html 为收音机添加背景,html,css,Html,Css,css文件: .radio { background: url(images/radio-off.png) no-repeat; height: 21px; width: 21px; } html文件: <input type="radio" name="sendmail" class="radio" value="send" /> 它仍然没有显示背景,仍然显示“经典”的背景。我做错了什么 谢谢。您不能这样设计单选按钮,因为它们是本机O/S控件 无论如何,现在的解

css文件:

.radio {
  background: url(images/radio-off.png) no-repeat;
  height: 21px;
  width: 21px;
}
html文件:

<input type="radio" name="sendmail" class="radio" value="send" />

它仍然没有显示背景,仍然显示“经典”的背景。我做错了什么


谢谢。

您不能这样设计单选按钮,因为它们是本机O/S控件

无论如何,现在的解决方案是在原始收音机的顶部覆盖一个模仿单选按钮的元素


查看输入增强库,例如。

您没有提到正在使用的浏览器-这是重要信息

不同浏览器对单选按钮(和
表单
元素)进行样式设置的能力差异很大

请看这里:

通常的解决方法是使用JavaScript将单选按钮替换为自定义元素,您可以根据自己的喜好设置样式


例如:。

实现这一点的最佳方法是使用Javascript以确保跨浏览器兼容性。 您可以使用以下脚本