css A的在线格式 高手进 在线等!~~~

来源:百度知道 编辑:UC知道 时间:2024/05/14 15:51:03
如题!

书上说CSS在线格式
<a target="_blank" style="text-decoration: none" href="1.htm">你好</a>

但是没说清楚如上连接的鼠标动作,如鼠标在连接上,点击击活链接等!我知道用<a class="link">这样可以引用此样式,但有些时候不想用外链的CSS 所以想问一下用<a style="">这样直接显示效果,如:当前无下划线并以红色,鼠标在链接上无下划线显示蓝色,等,请高手帮帮助,在线等,谢谢!

内联的css不能实现那些效果的.

style只能定义当前样式,鼠标滑过的样式没办法写在里面,要么js调样式,不过那样就复杂了.
或者你把样式写在a的外面,比如:
<div class="XXX"><a href="">你好</a></div>
div.XXX a {color: #f00; text-decoration: none;}
div.XXX a: hover {color: #00f; text-decoration: none;}
--------------------
外层的div换成你自己的结构,这样写同样不会影响到其它链接的样式

<style>
a:link {color:red;text-decoration:none;}
a:hover {color:blue;text-decoration:none;}
</style>

或者,你用JS实现也可以,别的方法不太清楚了

<a href="#" style="color:#00FF00;text-decoration:underline" onmouseover="this.style.color='#333'" onmouseout="this.style.color='#00FF00';this.style.font='宋体'">aaaaaaaaaaaa士大夫撒旦发</a>