如何創建:下一個和上一個按鈕

學習如何使用 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%;
}

親自試一試