CSS not cascading right

Discussion in 'HTML' started by Doug, Oct 29, 2004.

  1. Doug

    Doug Guest

    Well... i guess it's cascading right, but not like I want it to.

    Say I have a div to mark the main section of the page with an id of main.

    <div id="main-copy">
    ...
    <a href="foo.html>LinkName</a>
    ...
    </div>

    then in my stylesheet i have

    #main-copy a

    I also have links in the main-copy where i want it to override the other
    rule.

    <a class="location" href="tallahassee.html">Tallahassee</a>

    This rule doesn't change the color:

    a.location {
    color: #990000;
    font-size:90%;
    font-style:italic;
    text-decoration:none;
    }

    So, I could do
    #main-copy .location a
    but then I would have to do this for every section of the page (with
    many rules for the :hover, :link etc).
    #side-bar .location a
    #header .location a

    Is there any way around this, where i could only state this once in the
    stylesheet?

    -d
    Doug, Oct 29, 2004
    #1
    1. Advertising

  2. Doug

    rf Guest

    Doug wrote
    >
    > Well... i guess it's cascading right, but not like I want it to.


    You are talking about inheritance, not cascading.

    > Say I have a div to mark the main section of the page with an id of main.
    >
    > <div id="main-copy">
    > ...
    > <a href="foo.html>LinkName</a>
    > ...
    > </div>
    >
    > then in my stylesheet i have
    >
    > #main-copy a


    and what comes after this?

    > I also have links in the main-copy where i want it to override the other
    > rule.
    >
    > <a class="location" href="tallahassee.html">Tallahassee</a>
    >
    > This rule doesn't change the color:
    >
    > a.location {
    > color: #990000;
    > font-size:90%;
    > font-style:italic;
    > text-decoration:none;
    > }


    Do you have other rules like a.location:link etc

    >
    > So, I could do
    > #main-copy .location a
    > but then I would have to do this for every section of the page (with
    > many rules for the :hover, :link etc).
    > #side-bar .location a
    > #header .location a


    Ah, the plot thickens.

    > Is there any way around this, where i could only state this once in the
    > stylesheet?


    I can not see the problem. You will have to provide a URL to the page that
    exhibits this behavoiur. It is pointless looking at one little bit of the
    CSS.

    --
    Cheers
    Richard.
    rf, Oct 29, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    6,594
    Adrienne Boswell
    Jan 31, 2006
  2. Matt C.

    Q: cascading events not working?

    Matt C., Jun 26, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    324
    Matt C.
    Jun 26, 2006
  3. =?Utf-8?B?QmlzaG95?=
    Replies:
    0
    Views:
    953
    =?Utf-8?B?QmlzaG95?=
    Dec 28, 2006
  4. Software Engineer
    Replies:
    0
    Views:
    349
    Software Engineer
    Apr 2, 2007
  5. Terry
    Replies:
    14
    Views:
    180
    Thomas 'PointedEars' Lahn
    Oct 5, 2007
Loading...

Share This Page