悬停时如何更改ID颜色? [英] How to change ID colour when hovered?

查看:133
本文介绍了悬停时如何更改ID颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试获取ID#apDiv2更改背景颜色,但失败。所以我要求你可爱的人帮我解决这个问题。



 #apDiv2 a:hover {background-color:red;}  


解决方案

div (ID为 apDiv2 )中的任何 a #apDiv2 a:hover 中删除​​ a 此外,添加 cursor:pointer 可更改 hover 上的光标样式。



演示



 #apDiv2:hover {
background-color:red;
cursor:pointer;
}


I have been trying to get the ID #apDiv2 to change the background colour, but have failed. so I am asking you lovely people to help me solve this problem.

#apDiv2 a:hover {
    background-color: red;
}

解决方案

You don't have any a element inside the div with id apDiv2. Remove a from #apDiv2 a:hover and it should work. Additionally, add cursor: pointer to change the cursor style on hover.

Demo

#apDiv2:hover {
    background-color: red;
    cursor: pointer;
}

这篇关于悬停时如何更改ID颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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