What is the difference?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • shapper

    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

  • Harlan Messinger

    #2
    Re: What is the difference?

    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.

    Comment

    • dorayme

      #3
      Re: What is the difference?

      In article
      <1165458140.487 101.233300@l12g 2000cwl.googleg roups.com>,
      "shapper" <mdmoura@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="landscap es">

      <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

      Comment

      Working...