Nofollow atribute

Discussion in 'CSS' started by interval, Nov 25, 2007.

  1. #1
    Hi,

    I want to define two classes of links, ones to be followed by SEs and ones not (rel="nofollow")

    1. May I have two classes of links defined in CSS?
    2. How can I set nofollow atribute in CSS?

    Please help me with short examples

    Advnced thanks
    Interval
     
    interval, Nov 25, 2007 IP
  2. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can't do it this way. To use nofollow, you have to add rel="nofollow" to the link you don't want to be followed by the search engines, like so.

    
    <a href="somebadsite.com/someworsepage.html" [b]rel="nofollow"[/b]>I don't want the search engines to see this link</a>
    
    Code (markup):
    Now, if you're thinking of setting a class for the purpose of hiding the link from users while presenting it to the search engines, forget about it - they WILL find out about it and your site will be de-listed (read: banned).
     
    Dan Schulz, Nov 25, 2007 IP
  3. interval

    interval Peon

    Messages:
    53
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Dan, I know that.

    The question is to do that using CSS. I know I can set atributes for a link using something like

    a
    { color: #2e6e15; text-decoration: none;
    }

    In this case it is about color and text decoration atributes.
    What I want to know is if I can set two classes (types) of links, with and without 'nofollow' atribute. If yes I want to see how to do and I want to see how to use each CSS declaration when I build HTML code and I want that some links to be followed and some links not.
     
    interval, Nov 25, 2007 IP
  4. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #4
    <a href="/" rel="nofollow" class="nofollow">No Follow</a>
    <a href="../">Normal Link</a>
    Code (markup):
    a {
       font-weight: normal;
    }
    a.nofollow {
       font-weight: bold;
    }
    Code (markup):
    Once Internet Explorer gets its' act together on CSS it will be easier.
    Opera, & I believe but am not quite sure about Firefox, support attribute selectors.
    /* Anything with a "rel" attribute */
    a[rel] {
       font-weight: bold;
    }
    
    /* Anything with a "rel" attribute that is exactly "nofollow" */
    a[rel="nofollow"] {
       font-weight: bold;
    }
    Code (markup):
     
    joebert, Nov 25, 2007 IP