469,950 Members | 2,333 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

What is the difference?

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
2 1279
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
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.

Similar topics

13 posts views Thread by Jason Huang | last post: by
12 posts views Thread by Nathan Sokalski | last post: by
3 posts views Thread by Anoj Kumar | last post: by
49 posts views Thread by Zach | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.