【发布时间】:2014-12-10 04:08:57
【问题描述】:
<a href="#">Alink</a>
我需要的是,当我悬停时,链接的颜色应该改变,但它应该完全只使用内联 CSS
*无脚本或外部 CSS
请帮帮我。
【问题讨论】:
-
我认为你可以实现它。在 html 中添加 类似这样的
<a href="#">Alink</a>
我需要的是,当我悬停时,链接的颜色应该改变,但它应该完全只使用内联 CSS
*无脚本或外部 CSS
请帮帮我。
【问题讨论】:
仅使用 CSS 不会发生
内联javascript
<a href='index.html'
onmouseover='this.style.textDecoration="none"'
onmouseout='this.style.textDecoration="underline"'>
Click Me
</a>
在working draft of the CSS2 spec 中声明您可以像这样使用内联伪类:
<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>
但据我所知,它从未在规范的发布中实现。
http://www.w3.org/TR/2002/WD-css-style-attr-20020515#pseudo-rules
【讨论】: