CSS einer Tabelle zuweisen

CSS einer Tabelle zuweisen

Beitragvon DominikW » 06.09.2010, 13:53

Ich habe folgendes CSS extern als table.css gespeichert.

Code: Alles auswählen
table {
  border-collapse: collapse;
  border: none;
  font: normal 11px helvetica, verdana, arial, sans-serif;
  background-image: url(http://www.acuity.com.br/extern/icant.co.uk/bg_acuity.gif);
  background-repeat: repeat;

border-spacing: 1px;
  }
caption {
  text-align: left;
  font: normal 11px helvetica, verdana, arial,  sans-serif;
  background: transparent;
  }
td, th {
  border: none;
  padding: .8em;
  color: #6E6E6E;
  }
thead th, tfoot th {
  font: bold 10px helvetica, verdana, arial, sans-serif;
  border: none;
  text-align: left;
  background: #000000;
  color: #00FF0C;
  padding-top:4px;
  }
tbody td a {
  background: transparent;
  text-decoration: none;
  color: #9F9F9F;
  }
tbody td a:hover {
  background: transparent;
  color: #00FF0C;
  }
tbody th a {
  font: bold 11px helvetica, verdana, arial, sans-serif;
  background: transparent;
  text-decoration: none;
  font-weight:normal;
  color: #9F9F9F;
  }
 
 
tbody td+td+td+td a {
    padding-right: 14px;
    background: url(http://www.acuity.com.br/extern/icant.co.uk/arrow.gif) transparent no-repeat bottom right;
    }
    tbody td+td+td+td a:hover {
        padding-right: 14px;
    background: url(http://www.acuity.com.br/extern/icant.co.uk/arrow.gif) transparent no-repeat bottom right;
    }
tbody th a:hover {
  background: transparent;
  color: #00FF0C;
  }
tbody th, tbody td {
  vertical-align: top;
  text-align: left;
  }

.odd {
  background: #000000;
  }
tbody tr:hover {
  background: #0E0E0E;
  }
tbody tr:hover th,
tbody tr.odd:hover th {
  background: #0E0E0E;
  }


Nun will ich einer ganz normalen Tabelle dieses gespeicherte tabble.css zuweisen.

Code: Alles auswählen
<table border="0" width="100%">         
   <tr bgcolor="#CCCCCC">
                <td width="280" valign="top">Text 1</td>
      <td>Antwort 1</td>
   </tr>
         
   <tr bgcolor="#FFCC00">
      <td width="280" valign="top">Text 2</td>
      <td>Antwort 2</td>
   </tr>
</tabel>


Die ganze HP ist noch mit anderen CSS voll und irgendwie schaffe ich es nicht das table.css ausschließlich auf die tabelle anzuwenden.

Code: Alles auswählen
<link rel="stylesheet" href="format.css" type="text/css" />
<link rel="stylesheet" href="menue.css" type="text/css" />
<link rel="stylesheet" href="lightbox.css" type="text/css" media="screen" />
</head>
<body>



Kann mir wer helfen? :coffey:
DominikW
neu hier
 
Beiträge: 2
Registriert: 06.09.2010, 13:44

Re: CSS einer Tabelle zuweisen

Beitragvon sejuma » 06.09.2010, 14:19

So wie du es definiert hast, gelten die CSS-Angaben für sämtliche Tabellen.
Wenn du nur eine bestimmte Tabelle formatieren willst, dann verwende am besten eine Klasse.
Wie das funktioniert, siehst du hier ab Ziffer 4:
http://www.ohne-css.gehts-gar.net/0075.php
Bild
sejuma
Vielposter
 
Beiträge: 787
Registriert: 15.07.2009, 17:46

Re: CSS einer Tabelle zuweisen

Beitragvon DominikW » 06.09.2010, 14:42

Ah okay, jetzt ist mir klar warum das CSS immer auf die ganze Seite angewendet wird, die ganze Seite besteht aus Tabellen. Danke dir.
DominikW
neu hier
 
Beiträge: 2
Registriert: 06.09.2010, 13:44


Moderatoren: Laus, Moderatoren

Ähnliche Beiträge zu "CSS einer Tabelle zuweisen"

Zurück zu: CSS für Anfänger

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 2 Gäste

cron