about css syntax

this is my very simple html document
<body bgcolor="white">
<table width=500 bgcolor="black">
<a href="fff.htm">hellow</a><br>
<a href="fff.htm">goodbye</a>
<a href="elad.htm">elad</a>
i want that the 2 ancors inside the
table will be yellow and the ancor
that is out of table will be ordinary
notice that i dont want to do this:
<a class="rule" href="fff.htm"> hellow</a><br>
<a class="rule" href="fff.htm">goodbye</a>

because let's assume i have 50 links
and i dont want to type class="rule"
each time...
notice also that the <a href...
is inside the table.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You could create a class, and then ether surround the table in <DIV class="myclass">table goes here</DIV>

Or <table class="myclass">
eladrAuthor Commented:
is so...what should be my style tag?
please please give me complete answer.


you could do like this:
then just put id="yellow" in the a hrefe ex <a href="page.html" id="yellow">Yellow</a>
This should work and won't effect your other links.

it's possible to control style properties as a result of one element's containment of another.  if the anchor outside the table cell should have regular blue/purple/red, and the one inside should be yellow, it can be done like this:

<style type="text/css">
a:link { color: blue; background: white; }
a:visited { color: purple; background: white; }
a:active { color: red; background: white; }
td a:link { color: yellow; background: black; }

add 'visited' and 'active' coloring as you see fit.  notice that I define both foreground and background colors to make sure it doesn't clash with a user-defined style sheet.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.