V
V
Valentin Fetisov2017-02-12 20:17:01
Less
Valentin Fetisov, 2017-02-12 20:17:01

What is the correct way to use :not(:first-child)?

Hello! there is a menu with the following styles:

menu {
    text-align: justify;
    line-height: 0;
    padding: 0;
    margin-left: 30px;
    margin-right: 30px;
    &:after {
      width: 100%;
      height: 0;
      visibility: hidden;
      overflow: hidden;
      content: "";
      display: inline-block;
    }
    li {
      display: inline-block;
      text-align: left;
      padding: 5px 0;
      a {
        display: block;
        font-size: 18px;
        line-height: 1.3em;
        color: black;
        position: relative;
        text-transform: uppercase;
        &:hover{
        color: #c31e2f;
        }
        &:before  {
          top: 0;
          left: -15px;
          content: "\\\\";
          position: absolute;
          width: 5px;
          height: 5px;
          &:not(:first-child){}
        }
        &:hover {
          opacity: 0.8;
        }
      }
    }
  }

how to correctly apply the :before pseudo-element to all but the first element?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2017-02-12
@valentikus

li {
  display: inline-block;
  text-align: left;
  padding: 5px 0;

  a {
    display: block;
    font-size: 18px;
    line-height: 1.3em;
    color: black;
    position: relative;
    text-transform: uppercase;
    &:hover{
      color: #c31e2f;
      opacity: 0.8;
    }
  }

  &:not(:first-child) a:before {
    top: 0;
    left: -15px;
    content: "\\\\";
    position: absolute;
    width: 5px;
    height: 5px;
  }

}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question