6 replies [Last post]
nokia3410
Offline
newbie
Last seen: 16 years 10 weeks ago
Joined: 2004-08-13
Posts: 3
Points: 0

hi,

i am new here

how i can connect all links inside a table to a css style,

thanks,

nokia3410

Tony
Tony's picture
Offline
Moderator
Brisbane
Last seen: 1 week 2 days ago
Brisbane
Timezone: GMT+10
Joined: 2003-03-12
Posts: 5343
Points: 2964

link inside a table

Hi nokia3410,
Welcome to the CSS forum.
To target all the links within a table try

table a{color:green;} 
or if you have more then one table you could give the table you are targeting a class like<table class="mylinks">
then target it like.mylinks a{color:red;}

Hope that helps

nokia3410
Offline
newbie
Last seen: 16 years 10 weeks ago
Joined: 2004-08-13
Posts: 3
Points: 0

re:reply

Hi tony,

thank you fo your reply,

Actually my qstn is diff,

Please check this link : http://www.cellsina.com/links_page_4.htm

there you can find links inside a table,

i need to add css to this links,

now i am doing one by one, is there any other way to apply all.

i am new with html 7 internet

thanks

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 31 weeks 15 hours ago
Joined: 2004-06-30
Posts: 9668
Points: 801

link inside a table

Are you referring to the table on the left?

Verschwindende wrote:
  • CSS doesn't make pies

nokia3410
Offline
newbie
Last seen: 16 years 10 weeks ago
Joined: 2004-08-13
Posts: 3
Points: 0

re:reply

hi,

thanks for your reply,

on right with links

Please note this is my qstn : i made one table with 10 links, i want to add css to this links, not to the whole page only inside the table, now i am adding one by one

thanks

thepineapplehead
thepineapplehead's picture
Offline
Guru
Last seen: 31 weeks 15 hours ago
Joined: 2004-06-30
Posts: 9668
Points: 801

link inside a table

Then do exactly what Tony has said. I'll answer with some examples.

Say you have one page, with one table. THere are links on the page, and links in the table.

If in the css, you type

a {color: green;}

This will give EVERY link on the page a green color.

If you want to target only the table, you would use the following piece of CSS:

table a{color:green;}

However, if you have more than one table with regular text links in, then this will affect every table with links.

If you only want to target one table (eg a menu on the left of a site), then use the following in the CSS:

.mylinks a{color:red;}

and in the html, where you specify the left menu table, use this code

<table class="mylinks">

This will give EVERY link in ONLY THAT table a color of red, every other link will be whatever color you specified in the css (in the above example, green).

Verschwindende wrote:
  • CSS doesn't make pies

obsidian
Offline
Enthusiast
South Carolina
Last seen: 14 years 1 week ago
South Carolina
Joined: 2004-08-15
Posts: 136
Points: 0

link inside a table

The above recommendations are right on! But as a newbie to another newbie, just a couple things to keep in mind. If you want your hover color to be applied as well, be sure to define your link visited states before your hover state, or you will run in to some problems in the display. I like the recommendation about classes, because it won't limit your usage of the same method elsewhere on the same page.

Maybe this makes more sense:

Here is your table code calling the class called "links":

<table class="links" border="1">
<tr><td><a href="#">Link 1</a></td></tr>
<tr><td><a href="#">Link 2</a></td></tr>
<tr><td><a href="#">Link 3</a></td></tr>
</table>

And here is your CSS defining that class:
table.links a { color: #003399; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; }
table.links a:link, table.links a:visited { color: #003366; }
table.links a:hover { color: #CC9900; }

I find this to be quite effective since all you have to do is change the class name and CSS to make all your tables do different things with their links if you choose!

You can't win, you can't lose, you can't break even. You can't even get out of the game!