如何创建:下一个和上一个按钮

学习如何使用 CSS 创建“下一个”和“上一个”按钮。

下一个和上一个按钮

如何创建下一个和上一个按钮

第一步 - 添加 HTML:

<a href="#" class="previous">« Previous</a>
<a href="#" class="next">Next »</a>

<a href="#" class="previous round">‹</a>
<a href="#" class="next round">›</a>

第二步 - 添加 CSS:

a {
  text-decoration: none;
  display: inline-block;
  padding: 8px 16px;
}

a:hover {
  background-color: #ddd;
  color: black;
}

.previous {
  background-color: #f1f1f1;
  color: black;
}

.next {
  background-color: #04AA6D;
  color: white;
}

.round {
  border-radius: 50%;
}

亲自试一试