20. marts 2006 - 13:47
Der er
12 kommentarer og 1 løsning
Kan et link arve sin farve?
Jeg sidder og bliver sådan lidt træt af at skulle definere farver for links hele tiden :-) Kan det ikke lade sig gøre at et link arver sin farve fra det omgivende element? Således at hvis man har et <p style="color: green;"> det indeholdet et link, så vil linket automatisk blive grønt? krydser fingre for noget a'la "color: inherit" ....
Annonceindlæg fra Barco
21. marts 2006 - 15:26
#2
Bliver man ikke mere træt af at skrive <p style="color: green"> end a {color: green} eller p {color: green} ?
21. marts 2006 - 15:37
#3
Forstå mig ret: man har: p {color: green} .type1 {color: red} .type2 {color: yellow} .type3 {color: blue} .type4 {color: purple} Så er: a {color: inherit; font-weight: bold;} a:hover {text-decoration: underline;} noget nemmere end: a {font-weight: bold;} p a{color: green} p a:hover{text-decoration: underline;} .type1 a{color: red} .type1 a:hover{text-decoration: underline;} .type2 a{color: yellow} .type2 a:hover{text-decoration: underline;} .type3 a{color: blue} .type3 a:hover{text-decoration: underline;} .type4 a{color: purple} .type4 a:hover{text-decoration: underline;} hvilket man er nødt til lige nu i IE...
21. marts 2006 - 15:50
#4
Ok. Ikke at det besvarer dit spørgsmål, men man er vel ikke nødt til at definere linkopførsel for :hover, så mange gange? Hvad med: a {font-weight: bold;} a:hover {text-decoration: underline;} p, p a{color: green} .type1, type1 a {color: red} .type2, type2 a {color: yellow} .type3, type3 a {color: blue} .type4, type4 a {color: purple} ?
21. marts 2006 - 15:56
#5
jo, jeg har endda testet det. Når du definerer et link under et element: .type1 a{color: red} så går IE ud fra at den alm. a:hover ikke gælder under det element. Træls!
22. marts 2006 - 01:28
#6
Det virker da fint = ? ... ret evt ... a og a:hover efter test ... <html><head><style> a {font-size:20px;font-weight: bold;text-decoration: none;} a:hover{font-size:35px;font-weight: normal;text-decoration: underline;} p a{color: green} a.type1{color: red} a.type2{color: yellow} a.type3{color: blue} a.type4{color: purple} </style></head> <body> <p><a href="#">p</a><br /></p> <a href="#">a</a><br /> <a href="#" class="type1">a1</a><br /> <a href="#" class="type2">a2</a><br /> <a href="#" class="type3">a3</a><br /> <a href="#" class="type4">a4</a><br /> </body></html>
22. marts 2006 - 01:32
#7
eller det her hvis hover farven skal nedarves... <html><head><style> a {font-size:20px;font-weight: bold;text-decoration: none;} a:hover{color:gray;font-size:35px;font-weight: normal;text-decoration: underline;} p a{color: green} a.type1{color: red} a.type2{color: yellow} a.type3{color: blue} a.type4{color: purple} </style></head> <body> <p><a href="#">p</a><br /></p> <a href="#">a</a><br /> <a href="#" class="type1">a1</a><br /> <a href="#" class="type2">a2</a><br /> <a href="#" class="type3">a3</a><br /> <a href="#" class="type4">a4</a><br /> </body></html>
22. marts 2006 - 01:33
#8
og modsat ??? <html><head><style> a {color:gray;font-size:20px;font-weight: bold;text-decoration: none;} a:hover{font-size:35px;font-weight: normal;text-decoration: underline;} p a:hover{color: green} a.type1:hover{color: red} a.type2:hover{color: yellow} a.type3:hover{color: blue} a.type4:hover{color: purple} </style></head> <body> <p><a href="#">p</a><br /></p> <a href="#">a</a><br /> <a href="#" class="type1">a1</a><br /> <a href="#" class="type2">a2</a><br /> <a href="#" class="type3">a3</a><br /> <a href="#" class="type4">a4</a><br /> </body></html>
22. marts 2006 - 01:40
#9
hov, misforstod vist :/ ... sorry
22. marts 2006 - 01:43
#10
tror jeg forstod den nu :P <html><head><style> a {color:gray;font-size:20px;font-weight: bold;text-decoration: none;} a:hover{font-size:35px;font-weight: normal;text-decoration: underline;} .type1, a.type1{color: red} .type2, a.type2{color: yellow} .type3, a.type3{color: blue} .type4, a.type4{color: purple} </style></head> <body> <p><a href="#">p</a><br /></p> <p><a href="#" class="type1">tekst <a href="#" class="type1">a</a></p> <p><a href="#" class="type2">tekst <a href="#" class="type2">a</a></p> <p><a href="#" class="type3">tekst <a href="#" class="type3">a</a></p> <p><a href="#" class="type4">tekst <a href="#" class="type4">a</a></p> </body></html>
22. marts 2006 - 01:44
#11
- det var jo sent ... måske for sent :/
27. september 2006 - 20:26
#12
Lukker her
27. september 2006 - 20:26
#13
svar
Vi tilbyder markedets bedste kurser inden for webudvikling