本文介绍了如何更改选择中悬停选项的背景颜色和文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!
问题描述
我想在悬停时将此蓝色更改为透明,并将文本颜色更改为红色
I want to change this blue to transparent and the text color to red on hover
推荐答案
这是一个工作示例.- 单个选择选项无法设置样式.
Here is a working example. - A single select option cannot be styled.
我们在这里所做的是使用在点击时触发的 size 将选择更改为多选.转换为多选后,您可以设置选项悬停样式.
What we are doing here is changing the select to multiple selects using size which is triggered onclick. Once converted to a multiple select you can then style the option hover.
.blue:hover {background: blue;}
.green:hover {background: green;}
.red:hover {background: red;}
<select onfocus='this.size=3;' onblur='this.size=0;'
onchange='this.size=1; this.blur();'>
<option class="blue" >blue background</option>
<option class="green" >green background</option>
<option class="red" >red background</option>
</select>
这篇关于如何更改选择中悬停选项的背景颜色和文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!
The End




大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)