加载页面后,HTML链接会自动突出显示自身

时间:2013-03-18 08:38:37

标签: javascript css html5 hyperlink highlight

我为自己感到骄傲。我正在我的第一个网站&我刚刚使用“a”标签创建了我的第一个html链接:此时我似乎唯一的问题是,每次打开我的网页时,链接都会突出显示。我不必点击它,或将光标拖到它上面,或任何东西。我如何制作它,只有将光标拖到它上面才突出显示?非常感谢任何帮助,提前谢谢!

这是我的HTML:

<!DOCTYPE html>

<html lang="en">

<head>

<title>Round Table</title>

<meta charset="utf-8">
<link rel="stylesheet" href="RTH.css">
<script src="RTH.js"></script>

</head>

<body>


<H1> Come & take a seat at the Round Table B] </H1> 

<p> "Where <i>REAL MUSIC</i> still exists"</p><br><br>

<ol type=I> <H2> <li>BEAT$</li> 
<br><li>Music by Mercile$$</li> 
<br><li>Spoken Word</li> <br>
<li><a href="RthPg2.html" title="RthPg2">Tale$ of a Blind Sword$man</a></li> </H2> </ol><br><br><br>

<dt><i>RTH</i> consists of:</dt> 
<dd>Show Luciano, Pistol McFly, Dior, YZ, & last but not least...Mercile$$</dd>

<p> thee music industry is DEAD !! i hope to bring restoration.<br>

                                                                                            ~mercile$$</p><br>

<footer>&copy; Round Table</footer>
</font>
</body>
</html>

这是我的CSS:

body {
        background-image: url("Round Table, Hoe II.jpg");
    background-repeat: Repeat;
    font-family: AR Christy, Kozuka Gothic Pr6N, Cooper std;
    color: Red;
    text-shadow: 1px 0 0 #CEA40C, 0 -1px 0 #CEA40C, 0 1px 0 #CEA40C, -1px 0 0 #CEA40C;
        font-size: 25px;
        margin: 0 auto;
    text-align: center;
    width: 700px;

}

h1 {
    font-family: AR Christy, Kozuka Gothic Pr6N, Cooper std;
    color: Red;
    text-shadow: 2px 0 0 #CEA40C, 0 0px 0 #CEA40C, 0 2px 0 #CEA40C, 0px 0 0 #CEA40C;
        margin: 0 auto;
        text-align: center;
    width: 700px;

}

i {
    font-family: AR Christy, Kozuka Gothic Pr6N, Cooper std;
    color: White;
    text-shadow: 2px 0 0 #CEA40C, 0 0px 0 #CEA40C, 0 2px 0 #CEA40C, 0px 0 0 #CEA40C;
        margin: 0 auto;
        text-align: center;
    width: 700px;

}

dt {

    color: #1BD29B;
    text-shadow: 4px 0 0 #CEA40C, 0 0px 0 #CEA40C, 0 4px 0 #CEA40C, 0px 0 0 #CEA40C;
    font-size: 45pt;
    padding: 10px;


}

dd {

    color: White;
    padding: 5px 10px 5px 10px; 
    background: #f03; 
    border: solid 2px #fff;

}

p {
    padding: 5px 10px 5px 10px; 
    background: #f03; 
    border: solid 2px #fff; 

}

footer {



}

我还没有创建.js文件......

2 个答案:

答案 0 :(得分:1)

您可以将css选择器用于任何锚状态

a, a:visited, a:active {
     text-decoration: none;
     color: inherit; // from parent element
}
a:hover, a.highlighted {
    text-decoration: underline;
    color: blue;
    // anything you want
}

然后使用jquery在悬停上添加特定的类

$('a').hover(
    function () {
        $(this).addClass('highlighted');
    }
);

答案 1 :(得分:0)

将以下内容添加到您的CSS中,以使您的链接看起来像其他内容,并仅在悬停时突出显示自身(下划线)。

a {
    ...
    text-decoration: none;
    color: inherit;
}

a:hover {
    ...
    text-decoration: none;
    color: inherit;
}