SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Don't want to apply classes

    Right, I was wondering if the following is possible through css, I assume it is so its more a post asking hows its done.

    Is it possible to apply a class to a page(s) that will format certain things when they are displayed? i.e. I set the style sheet to display links in a certain way, to highlight any given type of headings in some way etc..

    Example page now;
    http://www.stablewars.com/ppv/faq.shtml

    Now on this page you can see the email adress is in purple as it is a link, the links below are in the default colour of a link without formatting.

    Now the email adress is the way it is because I have applied the appropriate class to it and I can make all the remaining links the same by indivially applying the class to it by adding it to the code. Below is the style sheet;

    a.menu:link { color: #FFFFFF; text-decoration: none; font-weight: bold }
    a.menu:active { color: red; text-decoration: none; font-weight: bold }
    a.menu:visited { color: #FFFFFF; text-decoration: none; font-weight: bold }
    a.menu:hover { color: #9999CC; text-decoration: none; font-weight: bold }

    a.skull:link { color: #666666; text-decoration: none; font-weight: bold }
    a.skull:active { color: red; text-decoration: none; font-weight: bold }
    a.skull:visited { color: #666666; text-decoration: none; font-weight: bold }
    a.skull:hover { color: #666666; text-decoration: underline; font-weight: bold }

    a.text:link { color: #9999CC; text-decoration: none; font-weight: bold }
    a.text:active { color: red; text-decoration: none; font-weight: bold }
    a.text:visited { color: #9999CC; text-decoration: none; font-weight: bold }
    a.text:hover { color: #9999CC; text-decoration: underline; font-weight: bold }


    So to get the same effect all i need to do is add class="text" to each link.

    But is there such a way to apply a sheet to a page and as soon as I make a link the css will take effect without me going through the code and applying the css?
    Last edited by Crippler; Jun 15, 2002 at 15:54.
    stablewars.com - WWF Fantasy Wrestling, It ain't no E-fed!

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if there's no other links, you can just define the links that way: i.e.

    Code:
    a {something}
    a:hover {something}
    That way, any links that aren't automatically written with some other class or id (i.e. specifically made the exception) will be like this. You will basically be redefining the default.

    HTH.
    Sketch
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The only problem for me with that approach is that I would have to add that peice of code on EVERY page I wanted to use it.

    Plus if I wanted to change the colur scheme I would once again have to go through every page to change it.

    Using a style sheet enables me to make changes to just one file and change all the others, was wonering if there was a way using a style sheet to over ride the default?
    stablewars.com - WWF Fantasy Wrestling, It ain't no E-fed!

  4. #4
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Guess I don't understand what the problem is then. What I wrote above IS how you override the default. There is no other way. The default is the default unless you say it's something different. Put it in a seaprate stylesheet if you wish so it only affects the page that you include that stylesheet on. But that's the only way to do it.

    Sketch
    Aaron Brazell
    Technosailor



  5. #5
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    :eek

    I think we're getting confused now...I assumed your reply meant I insert that bit of code in every page in the header?

    I believe you just suggested that I can put it in a style sheet and have it as the ONLY code dealing with links and it will automatically over ride the default? i.e. I will not have to apply class="so and so" to each link?

    But I take it, its not possible if im using different effects for link on different parts of the page i.e. those under the menu items.

    Thanks for the input anyway.
    stablewars.com - WWF Fantasy Wrestling, It ain't no E-fed!

  6. #6
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    put it in a stylesheet that is included on every page if you want the default on every page to be the new set. The only way to make any other links look anything other than the default is to assign them classes or ids.

    Sketch
    Aaron Brazell
    Technosailor



  7. #7
    SitePoint Addict
    Join Date
    Sep 2001
    Location
    London, UK
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it, and it worked!

    Thanks!
    stablewars.com - WWF Fantasy Wrestling, It ain't no E-fed!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •