如何使用 CSS 创建"下一个"和"上一个"按钮?
cssweb developmentfront end technology更新于 2025/10/5 7:08:17
以下是使用 CSS 创建"下一个"和"上一个"按钮的代码 −
示例
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
a {
text-decoration: none;
display: inline-block;
padding: 20px;
font-size: 35px;
width: 40px;
text-align: center;
}
.back:hover {
background-color: #ddd;
color: black;
}
.next:hover {
background-color: rgb(121, 37, 133);
color: white;
}
.back {
border-radius: 50%;
background-color: #acacac;
color: black;
}
.next {
border-radius: 50%;
background-color: rgb(68, 30, 112);
color: white;
}
</style>
</head>
<body>
<h1>Previous and Next Button Example</h1>
<a href="#" class="back">‹</a>
<a href="#" class="next">›</a>
</body>
</html>
输出
上述代码将产生以下输出 −

相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

