Files
workspace/code/base-project/base-vue/test.html
T
2025-09-02 17:30:58 +08:00

116 lines
3.0 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>按钮示例</title>
<!-- 这里使用 Font Awesome CDN,你可以换成自己的图标库 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
<style>
.btn {
display: inline-flex; /* 内部水平排列 */
align-items: center; /* 垂直居中 */
justify-content: center; /* 水平居中 */
gap: 4px; /* 图标和文字间距 */
padding: 8px 16px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #f4f5f5;
cursor: pointer;
font-size: 14px;
color: #333;
font-family: sans-serif;
}
.btn:hover {
background-color: #eaeaea;
}
.btn:active {
background-color: #dcdcdc;
}
.btn-icon {
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 16px; /* 控制图标大小 */
}
.btn-text {
display: inline-block;
}
</style>
</head>
<body>
<!-- 图标在左 -->
<button class="btn">
<i class="fas fa-check btn-icon"></i>
<span class="btn-text">按钮文字</span>
</button>
<!-- 图标在右 -->
<button class="btn">
<span class="btn-text">按钮文字</span>
<i class="fas fa-arrow-right btn-icon"></i>
</button>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>按钮示例</title>
<!-- 这里使用 Font Awesome CDN,你可以换成自己的图标库 -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
<style>
.btn {
display: inline-flex; /* 内部水平排列 */
align-items: center; /* 垂直居中 */
justify-content: center; /* 水平居中 */
gap: 4px; /* 图标和文字间距 */
padding: 8px 16px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #f4f5f5;
cursor: pointer;
font-size: 14px;
color: #333;
}
.btn:hover {
background-color: #eaeaea;
}
.btn:active {
background-color: #dcdcdc;
}
.btn-icon {
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 16px; /* 控制图标大小 */
}
.btn-text {
display: inline-block;
}
</style>
</head>
<body>
<!-- 图标在左 -->
<button class="btn">
<i class="fas fa-check btn-icon"></i>
<span class="btn-text">按钮文字</span>
</button>
<!-- 图标在右 -->
<button class="btn">
<span class="btn-text">按钮文字</span>
<i class="fas fa-arrow-right btn-icon"></i>
</button>
</body>
</html>