Forums

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

Home Forums CSS [Solved] Targeting only one

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #204723
    mateod747
    Participant

    Here is my code: http://codepen.io/mateod747/pen/RPMexy?editors=110

    My problem is that I can’t target only one <li> when i hover over it. I don’t know how to explain nicely but here is the code:

    .menu li:nth-child(1):hover {
      background: #fac22a;
      width:215px;
    }
    

    That code applies width to every li but I want it to apply style only to that one.

    #204724
    Paulie_D
    Member

    You have to remember that making the li bigger will make the ul bigger.

    What you are seeing is the ul getting bigger.

    #204727
    mateod747
    Participant

    Than I’ll have to find a way around because I can’t do it this way. Maybe put every <li> in another ul

    and then put different width to it?

    #204742
    Paulie_D
    Member

    If you can explain the effect you are going for we might be able to offer suggestions.

    #204845
    mateod747
    Participant

    I managed to do that effect by adding new unordered list for every menu link.

    http://codepen.io/mateod747/pen/RPMexy?editors=110

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