CSS & Hyperlinks

Sharky Forums


Results 1 to 10 of 10

Thread: CSS & Hyperlinks

  1. #1
    Catfish
    Join Date
    Sep 2000
    Posts
    111

    Question CSS & Hyperlinks

    I need to create a web page that displays two different styles of hyperlinks. I'd imagine one would use CSS to do this. I can create one style of a hyperlink by doing the following:

    a { text-decoration: none; color="#000000" }
    a.l { color: #000000; text-decoration: none }
    a.l2 { color: #000000; text-decoration: none }
    a.m { color: #000000; text-decoration: none }
    a:hover { color: #000000 }

    but this lets me use one style for the whole page. How could I create a class that allows me to use two(or more) different styles?

    ------------------
    - jeste®

    How could tomorrow ever follow today?
    - jeste®

    How could tomorrow ever follow today?

  2. #2
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322

    Post

    You have to actually name the class for each <a href> tag to make it work, like so:

    Say you have two sets of links attributes:
    a {text-decoration:underline;}
    a.two {text-decortation verline;}

    All links will be underlined now.If you want the links to have overline you have to do it like this:

    <a class=two href=http://bla.bla.bla>blabla</a>

    Hope this helps.

    ------------------
    Now listening to:
    Røyksopp - Apple

    [This message has been edited by kid A (edited January 05, 2001).]
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  3. #3
    Catfish
    Join Date
    Sep 2000
    Posts
    111

    Post

    Originally posted by kid A:
    You have to actually name the class for each <a href> tag to make it work, like so:

    Say you have two sets of links attributes:
    a {text-decoration:underline;}
    a.two {text-decortation verline;}

    All links will be underlined now.If you want the links to have overline you have to do it like this:

    <a class=two href=http://bla.bla.bla>blabla</a>

    Hope this helps.


    Hey, thanks! I've been trying all kinds of things to get that functionality to work. I was actually interested in the hover attribute which was

    a:hover.two { color: #FFFFFF }

    and it worked.

    ------------------
    - jeste®

    How could tomorrow ever follow today?
    - jeste®

    How could tomorrow ever follow today?

  4. #4
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322

    Post

    Yeah I forgot to mention that, but it's the exact same thing (as you found out)

    ------------------
    Now listening to:
    Røyksopp - Apple
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  5. #5
    Reef Shark Pestilence's Avatar
    Join Date
    Dec 2000
    Location
    Hickville, USA. :(
    Posts
    353

    Smile

    I was trying to figure out how to do thisas I forgot, I'm glad I know how to do it again.
    God damnit, better graphics != revolutionary gaming! Get it through your skull!

  6. #6
    Catfish
    Join Date
    Sep 2000
    Posts
    111

    Post

    Originally posted by Pestilence:
    I was trying to figure out how to do thisas I forgot, I'm glad I know how to do it again.
    Its a nice feature. Lets you create a seperate file and import it into each web page that you have. That way all of your fonts are the same.

    ------------------
    - jeste®

    How could tomorrow ever follow today?
    - jeste®

    How could tomorrow ever follow today?

  7. #7
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322

    Post

    Originally posted by jester:
    Its a nice feature. Lets you create a seperate file and import it into each web page that you have. That way all of your fonts are the same.

    You mean

    <link rel=stylesheet href=../styles.css type=text/css>

    ?? - That's a really good feature. I started making separate style sheets for each page, but that's just a complete waste of time. Using the above method it great for getting the same styles on all pages.

    ------------------
    Now listening to:
    Røyksopp - Apple

    [This message has been edited by kid A (edited January 10, 2001).]
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

  8. #8
    Catfish
    Join Date
    Sep 2000
    Posts
    111

    Post

    Originally posted by kid A:
    You mean

    <link rel=stylesheet href=../styles.css type=text/css>

    ?? - That's a really good feature. I started making separate style sheets for each page, but that's just a complete waste of time. Using the above method it great for getting the same styles on all pages.

    Thats the guy I was talking about. He's a life saver. Well, maybe not a life saver, but darn close to it.


    ------------------
    - jeste®

    How could tomorrow ever follow today?
    - jeste®

    How could tomorrow ever follow today?

  9. #9
    Tiger Shark GrayCalx's Avatar
    Join Date
    Nov 2000
    Location
    Northern VA
    Posts
    569

    Post

    I'm a little bit lazy... I just call all my pages .asp even style.asp then I just do a <!--#include ...-> at the top of all the pages that need to use style.asp. Even then you could name it .css, but whats the point?!
    XP 1600+
    MSI KT333
    512 PC2700
    AOpen Geforce4 4200

  10. #10
    Catfish
    Join Date
    Sep 2000
    Posts
    111

    Post

    Originally posted by GrayCalx:
    I'm a little bit lazy... I just call all my pages .asp even style.asp then I just do a <!--#include ...-> at the top of all the pages that need to use style.asp. Even then you could name it .css, but whats the point?!
    It may not be a big deal, but the difference is in the output. In your #include statement, the actual source is put into the "View Source" output. When you use the method described in the previous posts, there is no source output. The only way a person can get the source is to actually put the exact URL into the address bar. But no biggie.



    ------------------
    - jeste®

    How could tomorrow ever follow today?
    - jeste®

    How could tomorrow ever follow today?

Posting Permissions

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