Link Hover Over Issue

Discussion in 'CSS' started by Carsen, Mar 6, 2008.

  1. #1
    Hey guys,

    I have a Valid coded template and there is a section with links like this in the html -
    <p class="link"><a href="#">(19) Comments</a>  | <a href="#"> Read More </a>&gt;&gt;  |  Category: <a href="#">Laptops</a>  | Posted on March 4th 2008</p>
    Code (markup):
    and then in the CSS there is this for the links -
    #left a,.link{
      font-size: 12px;
      color: #009cff;
      text-decoration: underline;
    }
    Code (markup):
    I want the links to disappear the underline when hovered over, but if I do like -

    #left a:hover,.link{
      font-size: 12px;
      color: #009cff;
      text-decoration: none;
    }
    Code (markup):
    It screws up other parts of the CSS in different areas. Can anyone help?
     
    Carsen, Mar 6, 2008 IP
  2. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #2
    what if you just made it
    .link a:hover{
    font-size: 12px;
    color: #009cff;
    text-decoration: none;
    }
    Might have to change that particular p tag's class if there isnt a few hundred of them on the page.
     
    shallowink, Mar 6, 2008 IP
  3. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #3
    You are calling the css style improperly.

    when using "class" the entry in the style sheet would be .links

    When you put #links - that is an ID so it would have to be id="links" and not class="links"
     
    kentuckyslone, Mar 6, 2008 IP
  4. Carsen

    Carsen Well-Known Member

    Messages:
    427
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    140
    #4
    Its because it is in

    <div id="left">

    then

    <p class="link">

    Also shallowink that doesn't have any effect on it, So I think it has to call out the #left div ID.
     
    Carsen, Mar 6, 2008 IP
  5. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #5
    put it before it. Won't know the actual effect on the rest of the page though. Might help to add the p.link to make it more specific.
    #left p.link a:hover{
    font-size: 12px;
    color: #009cff;
    text-decoration: none;
    }
     
    shallowink, Mar 6, 2008 IP
  6. Carsen

    Carsen Well-Known Member

    Messages:
    427
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    140
    #6
    Great, Thanks so much, That fixed it :), Thanks again!
     
    Carsen, Mar 6, 2008 IP
  7. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #7
    either way if the style sheet has '.' it is class and '#' is ID using class="links" when the style sheet says #links will not work
     
    kentuckyslone, Mar 6, 2008 IP
  8. Carsen

    Carsen Well-Known Member

    Messages:
    427
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    140
    #8
    Yes, I know how to code CSS/DIVs...I was just having a problem with this piece of code and it was solved, Thanks for making me more aware of classes and ids in divs/css :p Mod/Admin please close this. Thank you for all your help guys!
     
    Carsen, Mar 6, 2008 IP