el-checkbox是一套纯CSS3的单选框、复选框、开关按钮UI库。这套CSS3 UI库有红、蓝、黄、绿四种颜色主题。均以em为单位,方便对组件大小定制,定义了small(85%)、default(100%)、large(125%)三种尺寸大小,可针对不同设计自由扩展。
使用方法
在页面中引入checkbox.css文件。
< link rel = "stylesheet" href = "css/checkbox.css" > |
HTML结构
该纯CSS3的单选框、复选框、开关按钮UI库的所有组件的HTML结构如下:
<!-- block,移动端适用 --> < label class = "el-checkbox" > <!-- 此行无样式定义 --> < span >custom text</ span > < input type = "checkbox" name = "check" value = "option" > < span class = "el-checkbox-style" ></ label > </ label > < label class = "el-radio" > < span >custom text</ span > < input type = "radio" name = "radio" value = "option" > < span class = "el-radio-style" ></ label > </ label > <!-- inline,PC端适用 --> < div class = "el-checkbox" > < span >custom text</ span > < input type = "checkbox" id = "checkbox" name = "check" value = "option" > < label for = "checkbox" class = "el-checkbox-style" ></ label > </ div > <!-- 开关 --> < label class = "el-switch" > < input type = "checkbox" name = "switch" checked hidden> < span class = "el-switch-style" ></ span > </ label > <!-- 不同尺寸(radio,checkbox同下) --> < label class = "el-switch el-switch-sm" > < input type = "checkbox" name = "switch" checked hidden> < span class = "el-switch-style" ></ span > </ label > < label class = "el-switch el-switch-lg" > < input type = "checkbox" name = "switch" checked hidden> < span class = "el-switch-style" ></ span > </ label > < label class = "el-switch" style = "font-size:150%" > < input type = "checkbox" name = "switch" checked hidden> < span class = "el-switch-style" ></ span > </ label > |
el-checkbox UI库的github地址为:https://github.com/EvanLiu2968/el-checkbox