改变checkbox字体颜色
时间: 2023-12-01 13:40:49 浏览: 43
可以使用CSS来改变checkbox的字体颜色。以下是一个例子:
```html
<!DOCTYPE html>
<html>
<head>
<style>
/* 选中的checkbox */
input[type=checkbox]:checked {
color: red;
}
/* 未选中的checkbox */
input[type=checkbox] {
color: blue;
}
</style>
</head>
<body>
<h2>Checkbox Example</h2>
<form>
<label for="fruit1">Orange</label>
<input type="checkbox" id="fruit1" name="fruits" value="Orange"><br>
<label for="fruit2">Banana</label>
<input type="checkbox" id="fruit2" name="fruits" value="Banana"><br>
<label for="fruit3">Apple</label>
<input type="checkbox" id="fruit3" name="fruits" value="Apple"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
```
在上面的例子中,选中的checkbox字体颜色为红色,未选中的checkbox字体颜色为蓝色。你可以根据需要修改颜色值。