A
A
Alexander Shtang2015-10-28 08:36:53
css
Alexander Shtang, 2015-10-28 08:36:53

How to do proper double nesting of pseudo-classes in LESS?

Look, here is an example from a topic on Habré on CSS:

.tooltip {
  border-bottom: 1px dotted #0077AA;
  cursor: help;
}

.tooltip::after {
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px 8px 8px 0px;
  box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.5);
  color: #FFF;
  content: attr(data-tooltip); /* Главная часть кода, определяющая содержимое всплывающей подсказки */
  margin-top: -24px;
  opacity: 0; /* Наш элемент прозрачен... */
  padding: 3px 7px;
  position: absolute;
  visibility: hidden; /* ...и скрыт. */
      
  transition: all 0.4s ease-in-out; /* Добавить плавности по вкусу */
}
    
.tooltip:hover::after {
  opacity: 1; /* Показываем его */
  visibility: visible;
}

How to do the same on LESS?
This option didn't work:
.tooltip {
  border-bottom: 1px dotted #0077AA;
  cursor: help;
  &::after {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 8px 8px 8px 0px;
    box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.5);
    color: #FFF;
    content: attr(data-tooltip); /* Главная часть кода, определяющая содержимое всплывающей подсказки */
    //margin-top: -24px;
    opacity: 0; /* Наш элемент прозрачен... */
    padding: 3px 7px;
    position: absolute;
    visibility: hidden; /* ...и скрыт. */

    transition: all 0.4s ease-in-out; /* Добавить плавности по вкусу */
  }
  &:hover {
    opacity: 1; /* Показываем его */
    visibility: visible;
  }
}

Something went wrong.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question