---
title: "class som hör till a-tag - fungerar inte..."
type: "forum-thread"
url: "https://www.webforum.nu/amne/html-css/67151-class-som-hör-till-a-tag-fungerar-inte"
topic: "HTML & CSS"
topic_url: "https://www.webforum.nu/amne/html-css"
author: "kittlos"
published: "2003-02-04T14:38:07.000Z"
updated: "2003-02-04T18:38:54.000Z"
replies: 4
views: 231
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/html-css/67151-class-som-hör-till-a-tag-fungerar-inte"
---

# class som hör till a-tag - fungerar inte...

## #1 — kittlos, 2003-02-04T14:38Z

Jag försöker använda en klass som hör till a-tagen, men lyckas inte.

Så här ser det ut i css:en:

```
a {color: #32496C; font-weight: bold; text-decoration:none;}
a:hover {text-decoration:underline;}
a:link { color: #32496C; font-weight: bold}
a:visited {color: #32496C; font-weight: bold}
a:active {color: #32496C; font-weight: bold}
a.white { color: white; font-weight: bold }
```

Och så här ser länken ut:

```
<a class="white" href="laggtill.php">Lägg till bild</a>
```

Vad gör jag för fel?

Permalänk: https://www.webforum.nu/p/67151

## #2 — Dino, 2003-02-04T14:45Z

```
a:link { color: #32496C; font-weight: bold; text-decoration:none;}
a:visited {color: #32496C; font-weight: bold; text-decoration:none;}
a:active {color: #32496C; font-weight: bold; text-decoration:none;}
a:hover {text-decoration:underline;}
a.white {color: white; font-weight: bold }
```

Permalänk: https://www.webforum.nu/p/940573

## #3 — kittlos, 2003-02-04T15:27Z

det hjälpte tyvärr inte. Kan det vara så att visited är överordnad klassen white? Det funkar nämligen på nya länkar, men inte befintliga, som alltså är visited.

Permalänk: https://www.webforum.nu/p/940615

## #4 — hypatia, 2003-02-04T18:07Z

Jag hade samma problem för ett tag sedan och löste det genom att specificera färger för visited osv. även i den class som hör till a-taggen. :)
 

```
a:link { color: #32496C; font-weight: bold; text-decoration:none;}
a:visited {color: #32496C; font-weight: bold; text-decoration:none;}
a:active {color: #32496C; font-weight: bold; text-decoration:none;}
a:hover {text-decoration:underline;}

a.white:link {color: white; font-weight: bold; }
a.white:visited {color: white; font-weight: bold; }
a.white:active {color: white; font-weight: bold; }
```

Permalänk: https://www.webforum.nu/p/940727

## #5 — jarvklo, 2003-02-04T18:38Z

Precis - Man bör specificera alla dessa :whatever-pseudo-klasser även för klassen white, efttersom a.white:visited annars inställningarna för a:visited osv på samma sätt som div.foo ärver inställningarna för div ;)

Permalänk: https://www.webforum.nu/p/940747

---

Tråden på webben: https://www.webforum.nu/amne/html-css/67151-class-som-hör-till-a-tag-fungerar-inte
