css 设置 checkbox复选框控件的对勾√样式
css 设置 checkbox复选框控件的对勾√样式 最终的样式,想要的效果: 我们要创建方框中的对勾,对于这一点,我们可以使用 伪类创建一个新的元素,为了实现这个样式,我们可以创建一个5px * 15px的长方形并给他加上边框。这时候我们去掉上面和右边的边框之后,它会看起来像一个字母L。然后我们可以使用CSS的 属性让它旋转一下,这样看起来就像是一个对勾。 <!DOCTYPE html> <html lang = "en" > <head> <meta charset = "UTF-8" > <title> 选中标签forcheck </title> <style type = "text/css" > . div - checked label { cursor : pointer ; position : relative ; display : inline - block ; width : 150px ; height : 38px ; border : 1px solid grey ; } /** * 按钮透明 * @type {String} */ input [ type = "checkbox" ] { opacity : 0 ; } /** * checkbox选中样式 * @type {String} */ input [ type = "checkbox"