2 replies [Last post]
akronnick
Offline
newbie
Last seen: 16 years 32 weeks ago
Joined: 2004-04-15
Posts: 2
Points: 0

Hi, this is probably very simple. However today is my first day applying css in this manner believe it or not. Everybody has to start somewhere! Anyway I would like to make a table so that every link that is in the table has the same style. If I apply the class "link1" to the individual links in the table code below they get applied nicely. But I would like to be able to make this automatic whenever there's a link in the table it gets .link1 as its style. Here's my non-working code:

.link1 { 
font-family: Arial, Helvetica, sans-serif; 
font-size: 10px; 
color: #9966FF; 
text-decoration: none; 
} 
.link1:hover { 
font-family: Arial, Helvetica, sans-serif; 
font-size: 10px; 
color: #00FFFF; 
text-decoration: none; 
} 

This is the table code I have, using the class"link1" attribute in the table tag.

<table width="95%"  border="0" cellpadding="0" cellspacing="6" class="link1">
      <tr>
        <td><p><a href="#">Job posting for Principal Investigator. (4/13/04)</a></p>
          <p><a href="#">E-Learning examples are here! (4/10/04)</a></p>
          <p><a href="#">This is another test link for what's new. (?/?/04 </a></p>
          <p><a href="#">This is a 1 liner. (?/?/04)</a></p>
          <p><a href="#">This is just another test! (4/1/04)</a></p></td>
      </tr>
    </table>

Thanks so much for your help.

co2
co2's picture
Offline
Leader
UK
Last seen: 12 years 32 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

applying .link1 class to table

If you keep your table class as link1, you would create the following CSS rule:

table.link1 a
     {
     font-family: Arial, Helvetica, sans-serif;
     font-size: 10px;
     color: #96f;
     text-decoration: none;
     }
table.link1 a:hover
     {
     color: #0ff;
     }

What this rule is stating is, style any 'a' tag within the table 'link1'.

The next sentence is true. The previous sentence is false. Discuss...

akronnick
Offline
newbie
Last seen: 16 years 32 weeks ago
Joined: 2004-04-15
Posts: 2
Points: 0

applying .link1 class to table

Thank you very much, the format on how to do this is crystal clear now. Laughing out loud