Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

verschiedene Linkfarben in <th> und <td> mit css

Empfohlene Antworten

Veröffentlicht

Hi,

ich hab eine Tabelle in meiner html Datei.

Diese Html Datei ist mit css formatiert

td

{

background-color: #FFFFFF;

}

a:link

{

text-decoration: underline;

color: #2558A5;

}

a:active

{

text-decoration: underline;

color: #2558A5;

}

a:visited

{

text-decoration: underline;

color: #2558A5;

}

a:hover

{

text-decoration: underline;

color: #2558A5;

}

jetzt habe ich folgendes Problem:

alle <th> Zeilen der Tabelle haben #2558A5 als Hintergrundfarbe und wenn jetzt in einer <th> ein Link ist, sieht man den logischerweise nicht mehr ...

th

{

background-color: #2558A5;

font-family: Arial;

font-size: 10pt;

font-weight: bold;

color: #FFFFFF;

}

ich hätte jetzt gerne das die links im <th> #FFFFFF (white) sind.

wie mache ich das mit css ???

Gruß Jürgen

indem du einen neuen stil anlegst und ihn dann den links in der tabelle zuweist.

also z.B. a:tabelle

dort schreibst du dann wie gewohnt die linkfarbe und die textdecoration rein und fertig.

müsste eigentlich so klappen...

Man kann das auch mit Klassen lösen.

Ich habe es so gemacht:

.link1

{

font-family:Arial, Helvetica;

text-decoration:none;

color:#18a6d6;

font-weight:bolder;

}

.link2

{

font-family:Arial, Helvetica;

text-decoration:none;

color:#18a6d6;

}

Das Linktag muss dann folgendermaßen geschrieben werden:

<a href="link.htm" class="link2">

reicht auch wenn du den stil nur tabelle nennst und diesen dann den gewünschten links zuweist.

hoffe mal, du benutzt dreamweaver und keinen texeditor.

in dw kannst du dann nämlich einfach den gewünschten text(links) markieren und den stil zuweisen. es wird dann dieser stil benutzt, obwohl ja eigentlich a:link das aussehen von links festlegt.

eine frage noch: wieso hast du eigentlich a:link, a:hover, a:hover usw. definiert; es steht doch sowieso bei allen das gleiche drin.

nur a:link hätte da auch gereicht.

ob man die linkfarben abhängig von <th> und <td> definieren kann, ist mir leider nicht bekannt.

könnte aber wohl irgendwie gehen.

vielleicht weiss es ja jemand...

habe den beitrag von cyberdemon leider zu spät gelesen, aber so meinte ich das ja auch.

nur ist jetzt immer noch nicht geklärt ob und wie man diese stile auch <td> und <th> zuordnen kann.

Mach's doch einfach mit Verschachtelten CSS-Elementen!

Also so:


<style type="text/css">

<!--

td

{

background-color: #FFFFFF;

}

a:link

{

text-decoration: underline;

color: #2558A5;

}

a:active

{

text-decoration: underline;

color: #2558A5;

}

a:visited

{

text-decoration: underline;

color: #2558A5;

}

a:hover

{

text-decoration: underline;

color: #2558A5;

}


th

{

background-color: #2558A5;

font-family: Arial;

font-size: 10pt;

font-weight: bold;

color: #FFFFFF;

}


th a:link

{

text-decoration: underline;

color: #ffffff;

}


th a:active

{

text-decoration: underline;

color: #ffffff;

}

th a:visited

{

text-decoration: underline;

color: #ffffff;

}

th a:hover

{

text-decoration: underline;

color: #ffffff;

}



-->

</style>

ICQ

Original geschrieben von CyberDemon

Dein Link funktioniert nicht. Er verweist auf ein lokales Dokument. ;)

:rolleyes:

Das kommt davon, wenn man Selfhtml lokal abspeichert und beim Copy&Paste nicht drauf achtet! *gg*

ICQ

PS: Link ist jetzt richtig! Danke Wolle!

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.