使用 CSS 创建按钮的禁用外观
cssweb developmentfront end technology更新于 2025/6/30 3:24:17
要创建按钮的禁用外观,请使用 CSS 不透明度属性。
示例
您可以尝试运行以下代码来创建按钮的禁用外观 −
<!DOCTYPE html>
<html>
<head>
<style>
.btn1 {
color: black;
text-align: center;
font-size: 15px;
}
.btn2 {
color: black;
text-align: center;
font-size: 15px;
opacity: 0.5;
}
</style>
</head>
<body>
<h2>Result</h2>
<p>Click below for result:</p>
<button class = "btn1">Enabled</button>
<button class = "btn2">Disabled</button>
</body>
</html>
相关文章
有用资源
css 参考教程 - 该教程包含有关 css 的更多信息:https://www.cainiaomax.com/css/

