Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Hover effect problem

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #41511
    Kaladan
    Member

    I have something of this sort:


    ul class="menu"
    li
    (a href="#"(span class="menu-entypo")⌂(/span)Home(/a)
    /li
    /ul

    I want to get the entypo font-icon to turn a color while the home text turns another color on hover over the a link. How do i do that ? Better yet, can i do that? I searched google but i can’t seem to find a way to do this and so i thought where else to find an answer then here sooooo here i am. Can anyone help me?

    #118491
    Andy Howells
    Participant

    EDIT: Hang on I reread your question. You want the regular text and the icon to be different colours?

    That’s actually a good one.

    How is the entypo character being loaded right now? Is it done via :before?

    If so you could chain the selector;

    span.menu-entypo:hover:before { color: red; }

    #118499
    Kaladan
    Member

    That is exactly what i want. I want the icon and the text to be different colors when i hover the link they are within.
    So far i load the icon via a span before the home text. I haven’t really tried it with :before yet, although i hear this is the best way to use it. The reason i haven’t tried it like that is because i thought writing it my way would be easier to actually do what i wanted it to do.
    I will try your method and i will get back to you as soon as i can. Unfortunately my day job takes a lot of my time. I bet you don’t have a lot of accountants members around here :))

    #118579
    magnus_vb
    Member

    Hey Kaladan,
    This might be one way to do it: [hover two colors](http://codepen.io/Magnusvb/pen/ljqsu “hover two colors”)

    li a:hover {
    color: red;
    }

    a:hover .menu-entypo {
    color: green;
    }

    I tried to solve it without the span – but could not

    #118594
    Kaladan
    Member

    This is excellent. Exactly what i needed. Thanks a lot Magnus_vb. Now that i see it, it seems quite easy but, by God, i wouldn’t have come up with this solution to save my life.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.