0

I'm sure this is a rather simple fix but I haven't been able to figure it out.

I used the page properties in Dreamweaver to come up with the CSS for the links on the page and everything was working correctly. I now have one row where I need to change both the link and hover colors for a few links.

<head>
<style type="text/css">
<!--
body {
background-color: #666666;
}

a:link {
color: #000000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #666666;
}
a:active {
text-decoration: none;
color: #000000;
-->
</style>
</head>

I was able to change the link color successfully by using the code below in the body.

<a href="url" target="_blank" style="color: rgb(20,80,153)">Website</a>

What I have not been able to do successfully is change the rollover. I've searched and tried a few different methods to solve the problem but haven't had any success. Could somebody point out what I'm doing wrong or give me an example of how the CSS should look?

4

4 回答 4

1

因此,要为您只需要的链接着色:

a{
    color: rgb(20,80,153);
    text-decoration: none;
}

然后,如果它悬停你想要:

a:hover {
    color: red;
}

HTML:

<a href="url" target="_blank">Website</a>

CSS:

a{
    color: rgb(20,80,153);
    text-decoration: none;
}
a:visited {
    text-decoration: none;
    color: #000000;
}
a:hover {
    color: red;
}

在这里演示


最重要的是,如果您不希望所有链接都使用它,请给它们一个类:

HTML:

<a href="url" class="test" target="_blank">Website</a>

CSS:

.test {
  color: rgb(20,80,153);
}

.test:hover {
  color: red;
}

在这里演示

于 2014-01-15T20:16:03.367 回答
1

给你的特殊链接一个特殊的类

CSS

.link
{
    color: rgb(20, 80, 153);
}

.link:hover{..}
.link:active{..}
.link:visited{..}

HTML

<a href="#" class="link">Website</a>
于 2014-01-15T20:16:22.167 回答
0

使用类名而不是仅仅针对a

CSS

a.someName1:link {
    color: #000000;
    text-decoration: none;
}

a.someName1:visited {
    text-decoration: none;
    color: #000000;
}

a.someName1:hover {
   text-decoration: none;
   color: #666666;
}

a.someName1:active {
   text-decoration: none;
   color: #000000;
 }

HTML

<a href="url" target="_blank" class="someName1">Website</a>
于 2014-01-15T20:15:57.250 回答
-1

更改整行颜色的最简单方法是向所述行添加一个类(或者<tr>,我假设),然后为作为具有该类的元素的后代的所有链接添加 CSS。

我对你的 HTML 做了一些假设,但它可能会像这样......

HTML:

<tr class="atl-color">
<td><a href="#">Link #1</a></td>
<td><a href="#">Link #2</a></td>
</tr>

CSS:

.alt-color a:link { color: blue; }
.alt-color a:hover { color: red; }
于 2014-01-15T20:23:03.073 回答