如何使用CSS悬停在html标签内? [英] How to use CSS hover inside html-tag?

查看:116
本文介绍了如何使用CSS悬停在html标签内?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想这样做:

<li style="hover:background-color:#006db9;">

但它不工作。

推荐答案

使用 style 属性是不可能的。您必须在文档本身或外部文件中使用CSS。

This is not possible using the style attribute. You'll have to use CSS, either in the document itself or in an external file.

li:hover { background-color:#006db9; }

如果这不是一个选项,那么你必须诉诸JavaScript。

If that's not an option then you'll have to resort to JavaScript.

这篇关于如何使用CSS悬停在html标签内?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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