简单的表单验证更改样式
知识点 运行效果 初始: 输入0-100: 输入错误: 每一次重新获得焦点样式都会重置 代码 < ! DOCTYPE html > < html lang = "en" > < head > < meta charset = "UTF-8" > < meta name = "viewport" content = "width=device-width, initial-scale=1.0" > < meta http - equiv = "X-UA-Compatible" content = "ie=edge" > < title > Document < / title > < style > #prompt { font - size : 13 px ; color : darkgrey ; } #score { border : 1 px solid darkgrey ; } . right { background : url ( "正确.png" ) no - repeat 5 px center ; background - size : 15 px 15 px ; padding - left : 20 px ; color : # 29 ff16 ! important ; } . error { background : url ( "错误 (1).png" )