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

HTML & CSS

4 svar · 231 visningar · startad av kittlos

Medlem sedan sep. 2002205 inlägg
Trådstart#1

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?

Medlem sedan sep. 20011 914 inlägg
#2
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 }
Medlem sedan sep. 2002205 inlägg
#3

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.

Medlem sedan feb. 20016 388 inlägg
#4

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; }
Medlem sedan juli 20013 378 inlägg
#5

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 ;)

262 ms totalt · 4 externa anrop · v20260731065814-full.d34c6d5a
125 ms — deklarationer (db)
0 ms — hämta statistik (cache)
132 ms — hämta tråd, inlägg och bilagor (db)
126 ms — ändringar (db)