L
L
lavezzi12015-08-08 11:28:29
css
lavezzi1, 2015-08-08 11:28:29

Why doesn't ::before apply?

Hello. I look through the inspector, the code is not applied, that is, there is no pneudoclass on the link. Why?

<h1>Подключение</h1>
            <a href="#0" class="cd-panel-close">Close</a>

.cd-panel-close {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 60px;

  /* image replacement */
  display: inline-block;
  overflow: hidden;
  text-indent: 100%;
  white-space: nowrap;

  &::before, &::after {
    /* close icon created in CSS */
    position: absolute;
    top: 22px;
    left: 20px;
    height: 3px;
    width: 20px;
    background-color: $color-3;
    /* this fixes a bug where pseudo elements are slighty off position */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  &::before {
    @include transform(rotate(45deg));
  }

  &::after {
    @include transform(rotate(-45deg));
  }

  .no-touch &:hover {
    background-color: $color-3;

    &::before, &::after {
      background-color: $color-4;
      @include transition-property(transform);
      @include transition-duration(.3s);
    }

    &::before {
      @include transform(rotate(220deg));
    }

    &::after {
      @include transform(rotate(135deg));
    }
  }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima Pautov, 2015-08-08
@lavezzi1

All :before , :after must always have content: '' ; Either with an empty value, or with the text you need! Otherwise, the element will not be displayed!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question