注册 登录
编程论坛 WEB前端(UI)

css 超链接问题

ab382717036 发布于 2011-04-25 16:49, 759 次点击
当点百度搜索上面的新闻时 新闻下面没有下划线且字体变黑 而其它的几个字体都没变这是怎么实现的。

百度  新闻 网页 贴吧 知道
当点击网页时 网页就变成黑色 且没下划线怎么实现
我页面用了一个.chara1 td{
    text-align:center;
}
a:link{                            /* 超链接正常状态下的样式 */
    color:red;                    /* 红色 */
    text-decoration:none;        /* 无下划线 */
}
a:visited{                        /* 访问过的超链接 */
    color:black;                /* 黑色 */
    text-decoration:none;        /* 无下划线 */
}
a:hover{                        /* 鼠标经过时的超链接 */
    color:yellow;                /* 黄色 */
    text-decoration:underline;    /* 下划线 */
}
我想用另一个伪超链接来显示我另一个页面不同的超链接效果请问怎么实现
比如我另一个页面 没点击是黑色 点击以后是红色的效果。

5 回复
#2
ab3827170362011-04-26 08:20
求助 怎么让chara1 td{}作用的某一处 请问怎么实现
#3
赵丹2011-04-26 16:36
新手报到
#4
didozhp2011-04-28 17:09
单独写个样式吧,定义一个class="current"
#5
liang1982072011-05-10 23:14
这个真做到像百度那样在同一个页面加上脚本可以实现,在多个页面只用CSS和脚本恐怕不好实现,主要是点连接的时候要进行页面的刷新。脚本的话也会回到原来的,要不就要写一些繁琐的判断了,那花这么大力气做一个这样的效果太不合算了,要是用动态的话那就简单了。单个页面我做了一下你看看有没有帮助
程序代码:

<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>超链接</title>
<link href="css.css" rel="stylesheet" type="text/css" />
<Script language="javascript" type="text/javascript">
<!--
function navtag(tid,tnum)
{
   
for (var t=0;t<=tnum;t++)
    {
        
if (t==tid){
        document.getElementById(t).innerHTML
=document.getElementById("uid"+t).innerText;
        document.getElementById(t).style.fontWeight.bold;
        }
        
else{
        document.getElementById(t).innerHTML
="<a id='uid"+t+"' href='c1.htm' class='news' onMouseUp='navtag("+t+",4)'>链接"+t+"</a>";
        }
    }
}
-->
</Script>
</head>

<body bgcolor="#C0C0C0">

<table cellpadding="0" cellspacing="0" width="457" height="25">
    <!-- MSTableType="nolayout" -->
    <tr>
        <td id="0" height="25" width="110" align="center">
        <a id="uid0" href="c1.htm" class="news" onMouseUp="navtag(0,4)">链接0</a></td>
        <td id="1" height="25" width="109" align="center">
        <a id="uid1" href="c1.htm" class="news" onMouseUp="navtag(1,4)">链接1</a></td>
        <td id="2" height="25" width="121" align="center">
        <a id="uid2" href="c1.htm" class="news" onMouseUp="navtag(2,4)">链接2</a></td>
        <td id="3" height="25" width="117" align="center">
        <a id="uid3" href="c1.htm" class="news" onMouseUp="navtag(3,4)">链接3</a></td>
    </tr>
</table>

</body>

</html>

#6
jimmy9052011-06-28 00:35
非常好
1