Using Code Block for Pseudo-Classes in LESS

Let's make a function that will set the link styles in the hover state.

Let this function take a block of code as a parameter:

styles.less.hover(@code) {
  
}

Let's print the passed block of code inside the hover state:

styles.less.hover(@code) {
  &:hover {
    @code();
  }
}

Let's use our function inside the link:

styles.lessa {
  color: red;
  
  .hover({
    color: blue;
    text-decoration: none;
  });
}

Compilation result:

styles.cssa {
  color: red;
}
a:hover {
  color: blue;
  text-decoration: none;
}
Задание 1

Make a similar function that will set styles for the input in the focus state.