Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to remove underline from heading links but not other links

    I know this a really simple one but it's driving me mad trying to find the answer so please help!

    I want all my links to be underlined except the ones that are also headings.

    What is the syntax of the selector for all h1,h2,h3 and h4 a:links?

    thanks!

  • #2
    Regular Coder Donkey's Avatar
    Join Date
    Sep 2003
    Location
    Blackfield UK
    Posts
    312
    Thanks
    1
    Thanked 36 Times in 36 Posts
    I would use this

    Code:
    h1 a,
    h1 a:link,
    h1 a:visited,
    h1 a:focus,
    h1 a:hover,
    h1 a:active,
    h2 a,
    h2 a:link,
    h3 a:visited,
    h2 a:focus,
    h2 a:hover,
    h2 a:active,
    h3 a,
    h3 a:link,
    h3 a:visited,
    h3 a:focus,
    h3 a:hover,
    h3 a:active,
    h4 a,
    h4 a:link,
    h4 a:visited,
    h4 a:focus,
    h4 a:hover,
    h4 a:active
    {
    text-decoration : none;
    }
    It seems a bit long winded and there may be a way to simplify it but you need to put in all the link states (In that order or they may not work properly remember "Luke Vader Former Handle Anakin) because if you don't some other link code later in the style sheet may override particularly focus, hover and active states.
    Last edited by Donkey; 07-10-2008 at 02:19 PM. Reason: typo
    " 90% of everything is crud" - Theodore Sturgeon
    Filthy Beast - a 60's Rock Band

  • #3
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    crikey that is long! no wonder i couldn't figure it out - i was looking for a shortcut.

    thank you thank you thank you for helping out a confused novice.

    h

  • #4
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    Thanked 257 Times in 257 Posts
    Donkey, would it be easier to just use this

    Code:
    * {
    text-decoration:none;
    }
    not to confuse you hannahkc, but would that be easier to use and then later define a certain element with a decoration somewhere else in the CSS if needed?

  • #5
    Regular Coder Donkey's Avatar
    Join Date
    Sep 2003
    Location
    Blackfield UK
    Posts
    312
    Thanks
    1
    Thanked 36 Times in 36 Posts
    Quote Originally Posted by jcdevelopment View Post
    Donkey, would it be easier to just use this
    Yes JCD you are right, it certainly would be. (Curses! never thought of that one. :~) )
    " 90% of everything is crud" - Theodore Sturgeon
    Filthy Beast - a 60's Rock Band

  • #6
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    Thanked 257 Times in 257 Posts
    well i didnt want to over-rule your suggestion, i wasnt sure if he was looking for only a specific thing such as a header and link

    Code:
    <h1><a href="#">Link</a></h1>
    instead of

    Code:
    <a href="#">Link</a>
    Sorry i didnt want to confuse hannahkc at all, haha sorry!


  •  

    Posting Permissions

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