CSS:nux-link的nth-of-type()选择器

时间:2018-06-19 14:33:03

标签: css vuejs2 nuxt.js

我正在尝试使CSS菜单正常工作,但想使用vuejs / nuxt-link而不是传统的href,因为这是一个单页应用程序,我正在尝试学习如何构建

我有以下

如何将其转换为使用nuxt-link而不是href

谢谢

我目前拥有的HTML

<nav class="radial">
  <input type="checkbox" id="menu" checked>
  <a href="" class="fa fa-question">About</a>
  <a href="" class="fa fa-book">Resume</a>
  <a href="" class="fa fa-code">Blog</a>
  <a href="" class="fa fa-github">Github</a>
  <a href="" class="fa fa-stack-exchange">a</a>
  <label for="menu" class='fa-bars'>Menu</label>
</nav>

假设这是可能的,我想在html中使用(例如)。

<nuxt-link :to="'/about'"><fa icon="bars" /></nuxt-link> 

我目前拥有的CSS如下

nav.radial {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  position: relative;
  top: -2.5rem;
  width: 3rem;
  height: 3rem;
  margin: 0 100px;
}
nav.radial input {
  display: none;
}
nav.radial > label,
nav.radial > a {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #21618C;
  color: white;
  text-align: center;
  font-size: 0;
  line-height: 3rem;
}
nav.radial label:before,
nav.radial a:before {
  font-size: 1.2rem;
  color: white;
}
nav.radial a {
  color: transparent;
  text-decoration: none;
  box-sizing: border-box;
}
nav.radial label {
  border-radius: 0 0 1.5rem 1.5rem;
  cursor: pointer;
  box-sizing: border-box;
  border-bottom: 0.25rem solid #2f2f2f;
  box-shadow: 0 0.1875rem rgba(0, 0, 0, 0.25);
  transition: border-bottom 0.25s, box-shadow 0.5s;
}
nav.radial input:checked ~ label {
  border-bottom-width: 1px;
  box-shadow: none;
}
nav.radial a[href] {
  transition: top 0.1s, left 0.25s, opacity 1s, box-shadow 0.25s;
  border-radius: 1.5rem;
  opacity: 0;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  border-bottom: 1px solid #888;
  box-sizing: border-box;
}
nav.radial a[href]:hover {
  background-color: #E6EDF2;
  border-bottom-color: #2c7768;
}
nav.radial input:checked ~ a[href] {
  transition: top 1s, left 0.6s, box-shadow 1s, background-color 0.25s, border-bottom-color 0.25s, border-bottom-width 0.25s;
  opacity: 1;
}
nav.radial a[href]:hover {
  border-bottom-width: 0.25rem;
}
nav.radial input:checked ~ a[href]:nth-of-type(1),
nav.radial input:checked ~ a[href]:nth-of-type(5) {
  box-shadow: 0 -0.1875rem 0.375rem rgba(0, 0, 0, 0.25);
}
nav.radial input:checked ~ a[href]:nth-of-type(1) {
  left: -4.72707721rem;
  top: 0.83351125rem;
}
nav.radial input:checked ~ a[href]:nth-of-type(2) {
  left: -3.08538053rem;
  top: 3.67701333rem;
}
nav.radial input:checked ~ a[href]:nth-of-type(3) {
  left: 0rem;
  top: 4.8rem;
}
nav.radial input:checked ~ a[href]:nth-of-type(4) {
  left: 3.08538053rem;
  top: 3.67701333rem;
}
nav.radial input:checked ~ a[href]:nth-of-type(5) {
  left: 4.72707721rem;
  top: 0.83351125rem;
}

非常感谢您的提前协助

0 个答案:

没有答案