仅为非非悬浮元素设置样式 [英] Set style for not not hovered elements only

查看:47
本文介绍了仅为非非悬浮元素设置样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置不是hovered元素的样式?

How is it possible to set style for not not "hovered" elements only?

例如:

<input id="1"/>
<input id="2"/>
<input id="3"/>
<input id="4"/>

输入3被悬停。

input {
  background-color:red;
}


推荐答案

input {
  background-color: red;
}

input:hover {
  background-color: transparent;
}

transparent 如果没有设置,默认值为background-color,因此明确设置它将强制它为默认值。

transparent is the default value to background-color if nothing is set, so setting it explicitly will force it to the default value.

这篇关于仅为非非悬浮元素设置样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆