/* 示例代码:使用 CSS 设置禁用样式 */
/* 1. 禁用按钮 */
button:disabled {
background-color: gray;
color: white;
cursor: not-allowed;
}
/* 2. 禁用输入框 */
input:disabled {
background-color: #e9e9e9;
color: #aaa;
cursor: not-allowed;
}
/* 3. 禁用复选框和单选按钮 */
input[type="checkbox"]:disabled,
input[type="radio"]:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* 解释说明:
- :disabled 是 CSS 伪类,用于选择处于禁用状态的表单元素。
- 背景颜色、文本颜色和光标的样式可以根据需要自定义,以表示元素不可用的状态。
- 通过设置 `cursor: not-allowed`,当用户将鼠标悬停在禁用元素上时,光标会显示为禁止符号。 */
上一篇:换行css
下一篇:css flex:1
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站