Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: CSS exception on external link

  1. #1
    Join Date
    Jul 2011
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default CSS exception on external link

    I currently have an external link icon put after each link created. I do not want an external link icon on Google links

    /* CSS Code */

    a[href^="http:"]
    {
    display:inline-block;
    padding-right:14px;
    background:transparent url(="extlink.gif) no-repeat 100% 0;
    padding: 0 20px 0 0
    }


    a[href^="http:"] :hover:after { content: " > " attr (title);


    a[href*="google"]{
    background-image:none;
    }
    a[href*="google"] :hover:after { content: " "; }


    I have also tried

    a[href*="http://google"]{

    this doesn't work either.


    Anyone have any ideas?

  2. #2
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there phipm1,

    and a warm welcome to these forums.

    try it like this...
    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    
    <title></title>
    
    <style type="text/css">
    a  {
        display:inline-block;
        padding-right:14px;
        background:transparent url('http://www.coothead.co.uk/images/anim2.gif') no-repeat 100% 0;
        color:#000;
     }
    a:hover:after  { 
        content: ">"; 
     }
    a[href*="google"]  {
        background-image:none;
     }
    a[href*="google"]:hover:after  { 
        content: " "; 
     }
    </style>
    
    </head>
    <body>
    
    <ul>
     <li><a href="http://www.google.com">google.com</a></li>
     <li><a href="http://www.dynamicdrive.com/">dynamicdrive.com</a></li>
     <li><a href="http://www.google.co.uk">google.co.uk</a></li>
    </ul>
    
    </body>
    </html>
    
    coothead
    Last edited by coothead; 07-19-2011 at 09:24 PM.

  3. The Following User Says Thank You to coothead For This Useful Post:

    phipm1 (07-20-2011)

  4. #3
    Join Date
    Jul 2011
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    Thanks so much, works great!!!

  5. #4
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    No problem, you're very welcome.

  6. #5
    Join Date
    Jul 2011
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    how would you assign a attribute title to all links except the ones going to Google?

  7. #6
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there phipm1,

    try it like this...
    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    
    <title></title>
    
    <style type="text/css">
    a:not([href*="google"]) {
        color:#f00;
     }
    </style>
    
    </head>
    <body>
    
    <ul>
     <li><a href="http//www.google.com">google.com</a></li>
     <li><a href="http://www.dynamicdrive.com/">dynamicdrive.com</a></li>
     <li><a href="http//www.google.co.uk">google.co.uk</a></li>
     <li><a href="http://www.bbc.co.uk/">bbc.co.uk</a></li>
    </ul>
    
    </body>
    </html>
    
    Obviously, this will only work in modern browsers.

    Further reading:-

    coothead

  8. #7
    Join Date
    Jul 2011
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I want a hyperlink title "you are leaving" to show up automatically on all links, except the Google links.

    Am I going about this the right way?

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english">
    <meta http-equiv="Content-Style-Type" content="text/css">

    <title></title>

    <style type="text/css">
    a {
    display:inline-block;
    padding-right:14px;
    background:transparent url('http://www.coothead.co.uk/images/anim2.gif') no-repeat 100% 0;
    color:#000;

    }
    a:hover:after {
    content: ">";
    }
    a[href*="google"] {
    background-image:none;
    }
    a[href*="google"]:hover:after {
    content: " ";
    }


    a:not([href*="google"]) {
    color:#f00;
    }


    </style>

    </head>
    <body class="add">


    <p><a href="http://www.google.com" google.com</a></p>
    <p>



    <a href="http://www.yahoo.com/" yahoo.com</a></p>
    <p>



    <a href="http://www.google.co.uk" google.co.uk</a></p>
    </body>
    </html>
    Last edited by phipm1; 07-21-2011 at 02:53 PM.

  9. #8
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there phipm1,

    does this help...
    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <meta name="language" content="english"> 
    <meta http-equiv="Content-Style-Type" content="text/css">
    
    <title></title>
    
    <style type="text/css">
    a {
       color:#000;
     }
    a:not([href*="google"]):before {
        content:'you are leaving to...';
        color:#f00;
     }
    </style>
    
    </head>
    <body>
    
    <ul>
     <li><a href="http//www.google.com">google.com</a></li>
     <li><a href="http://www.dynamicdrive.com/">dynamicdrive.com</a></li>
     <li><a href="http//www.google.co.uk">google.co.uk</a></li>
     <li><a href="http://www.bbc.co.uk/">bbc.co.uk</a></li>
    </ul>
    
    </body>
    </html>
    
    coothead

  10. #9
    Join Date
    Jul 2011
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Default

    I can't get the code to work for me. It doesn't show the title tags.

  11. #10
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there phipm1,

    CSS is used to style HTML elements.

    To add content to the HTML attributes requires serverside or client side scripting.

    coothead

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
  •