|
|||
![]()
Hallo zusammen!
Hab ein kleines Problem bei der Definition von einem Style für einen a - Tag. Im folgenden Code-Beispiel wird bekommt der "Right-Link" einen eigenen Style (rot, unterstrichen) über die Klasse "custStyle" zugewiesen. Trotzdem wird immer der im "#footer" allgemein definierte Style (schwarz, nicht unterstrichen) dargestellt. Kann sich das jemand erklären? Bin dankbar für jeden Tipp! Gruß, vidar Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de"> <head> <title>Unbenannt</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style> a.custStyle, a.custStyle:link, a.custStyle:visited { color: #FF3300; text-decoration: underline; font-weight: normal; } a.custStyle:hover, a.custStyle:active { color: #FF3300; text-decoration: underline; font-weight: normal; } #footer a, #footer a:link, #footer a:visited { color: #000000; text-decoration: none; font-weight: normal; } #footer a:hover, #footer a:active { color: #000000; text-decoration: none; font-weight: normal; } </style> </head> <body> <div id="footer"> <div id="left"> <a href="#">Left-Link</a> </div> <br /><br /> <div id="right"> <a href="#" class="custStyle">Right-Link</a> </div> </div> </body> </html> |
Sponsored Links |
|
|||
![]()
Lies Dir in deiner Lieblings-CSS-Referenz den Kapitel über Spezifität durch. Eine CSS-Regel mit einer ID hat eine Höhere Spezifität (Priorität) als eines mit einer Klasse. In deinem Fall könntest du es so machen:
Code:
#footer a.custStyle, #footer a.custStyle:link, #footer a.custStyle:visited { ... } Robin |
Sponsored Links |
|
|||
![]() Zitat:
vidar |
|
|||
![]()
Nun das kommt auf die gesamte Struktur der Seite drauf an. Du müsstest entweder eine ID (oder mehrer IDs) finden, in der alle "custStyle" vorkommen, z.B.:
Code:
#content a.custStyle, #menu a.custStyle, #footer a.custStyle { ... } Code:
#wrapper a.custStyle { ... } Robin |
|
|||
![]() Zitat:
thx für deine Tipps! gruß, vidar |
![]() |
Themen-Optionen | |
Ansicht | |
|
|
![]() |
||||
Thema | Autor | Forum | Antworten | Letzter Beitrag |
Jquery Load Div Problem / Css Style wird nicht erkannt | mastaa | Javascript & Ajax | 5 | 16.03.2011 17:50 |
IE6:Horizontales Menü wird unterschiedlich angezeigt:erst falsch, nach Reload korrekt | Ste | CSS | 0 | 25.02.2009 13:46 |
Darstellungsprobleme im IE7 - FF, Google Chrome zeigen korrekt | webrise | CSS | 6 | 05.09.2008 11:33 |
Style Sheet Reihenfolge | laborix | CSS | 7 | 02.09.2007 16:23 |
CSS Style wird nicht übernommen... | masterbigjoe | (X)HTML | 3 | 08.03.2007 09:48 |