LESS - 具有相同风格的多个不同类别?

时间:2016-10-28 17:26:53

标签: css less

你如何在LESS中写下这种风格?

public IActionResult MyContactInfo([ModelBinder(BinderType = typeof(Binders.TrimModelBinder), Name = "TrimModelBinder")] MyAccountModel mam)
{
    //...
}

我的尝试:

nav a:hover,
nav a:focus,
footer a:hover,
footer a:focus,
.fullscreen-container a:hover,
.fullscreen-container a:focus {
    text-decoration: none;
}

结果:

{{2} }

理想的结果:

.text-decoration-none () {
    text-decoration: none;
}

nav a {
    &:focus,
    &:focus {
        .text-decoration-none ();
    }
}

footer a {
    &:focus,
    &:focus {
        .text-decoration-none ();
    }
}

.fullscreen-container a {
    &:focus,
    &:focus {
        .text-decoration-none ();
    }
}

任何想法?

2 个答案:

答案 0 :(得分:6)

nav, footer, .fullscreen-container {
  a {
    &:hover, &:focus {
      text-decoration: none;
    }
  }
}

答案 1 :(得分:1)

.text-decoration-none () {
    text-decoration: none;
}

nav a, footer a, .fullscreen-container a {
    &:hover,
    &:focus {
        .text-decoration-none ();
    }
}
相关问题