By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,574 Members | 1,201 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,574 IT Pros & Developers. It's quick & easy.

What is the difference?

P: n/a
Hello,

I want to redefine the way an <atag behaves.

I saw to approaches:

.myClass a { ... }

and

a.myClass { ... }

What is the difference?

Which one should I use and how to apply them?

I also need to change the style of a:link and a:hover.
Can I use both approaches for this?

Thank You,
Miguel

Dec 7 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
shapper wrote:
Hello,

I want to redefine the way an <atag behaves.

I saw to approaches:

.myClass a { ... }
This matches A tags that are inside any tags of class "myclass".
>
and

a.myClass { ... }
This matches A tags that have class "myclass".
>
What is the difference?

Which one should I use and how to apply them?
Whichever one matches the element you're trying to style.
>
I also need to change the style of a:link and a:hover.
Can I use both approaches for this?
Only the one that applies.
Dec 7 '06 #2

P: n/a
In article
<11**********************@l12g2000cwl.googlegroups .com>,
"shapper" <md*****@gmail.comwrote:
Hello,

I want to redefine the way an <atag behaves.

I saw to approaches:

.myClass a { ... }

and

a.myClass { ... }

What is the difference?

Which one should I use and how to apply them?

In the first, there is an element that is classed, inside of
which are some links. This way of identifying the links you want
a certain style is often better because it saves having to class
a lot of links individually.

eg.

<ul class="landscapes">

<li><a href="" ...>Picture of my house from the side</a></li>

<li><a href="" ...>Picture of my eel from the side</a></li>

<li><a href="" ...>Picture of beach storming troops as seen
through the slit in my machine gun nest</a></li>

etc

</ul>
The other way is more suited to where there are either just very
few links to be styled or to where the links to be thus styled
are scattered in all sorts of diverse contexts. You target them
individually.
>
I also need to change the style of a:link and a:hover.
Can I use both approaches for this?
Yes.

--
dorayme
Dec 10 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.