如何编写:使用内联样式悬停? [英] How to write :hover using inline style?
本文介绍了如何编写:使用内联样式悬停?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<a href="#">Alink</a>
我需要的是当我悬停时颜色应该改变为链接,但它应该完全使用只有内联CSS
All i need is while i hover the color should change for the link, But it should be completely using only inline CSS
*无脚本或外部CSS
*No Scripting or external CSS
请帮我解决这个问题。
推荐答案
不会发生在CSS上
内嵌javascript
Inline javascript
<a href='index.html'
onmouseover='this.style.textDecoration="none"'
onmouseout='this.style.textDecoration="underline"'>
Click Me
</a>
在 CSS2 spe的工作草案c被宣称可以使用伪类似这样的内联:
In a working draft of the CSS2 spec it was declared that you could use pseudo-classes inline like this:
<a href="http://www.w3.org/Style/CSS"
style="{color: blue; background: white} /* a+=0 b+=0 c+=0 */
:visited {color: green} /* a+=0 b+=1 c+=0 */
:hover {background: yellow} /* a+=0 b+=1 c+=0 */
:visited:hover {color: purple} /* a+=0 b+=2 c+=0 */
">
</a>
但据我所知,它从未在规范的发布中实现。
but it was never implemented in the release of the spec as far as I know.
http://www.w3.org/TR/2002/WD-css-style-attr-20020515#pseudo-rules
这篇关于如何编写:使用内联样式悬停?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文