页面上的实心圆圈, 一种方法我们可以用图片, 那同时也可以直接用CSS直接生成,
效果图:
方式如下:
1 | < div class = "circle" ></ div > |
1 2 3 4 5 6 7 8 9 10 | . circle { box-sizing: border-box; background- clip : content-box; background-color : green ; border : 2px solid green ; width : 18px ; height : 18px ; padding : 4px ; border-radius: 50% ; } |
表单应用实例:
1 2 3 4 5 6 7 8 9 10 11 12 13 | < form class = "form" > < li class = "input-box" > < div class = "fl sex" > < input type = "radio" name = "sex" value = "男" checked> < em >< i ></ i >先生</ em > </ div > < div class = "fl sex" > < input type = "radio" name = "sex" value = "女" > < em >< i ></ i >女士</ em > </ div > </ li > </ form > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | *{ paging: 0 ; margin : 0 ;box-sizing: border-box; font-size : 14px ;} li{ list-style : none ;} .fl{ float : left ;} .form{ width : 500px ; margin : 50px auto ; } .sex{ width : 50px ; margin : 30px ; position : relative ; color : #999 ; line-height : 40px ; } .sex input[type= "radio" ]{ position : absolute ; width : 100% ; height : 100% ; display : block ; z-index : 1 ; cursor : pointer ; -khtml-opacity: 0 ; -moz-opacity: 0 ; filter: alpha(opacity= 0 ); filter: "alpha(opacity=0)" ; opacity: 0 ; } .sex em{ position : relative ; display : block ; padding-left : 22px ; } .sex em i{ width : 18px ; height : 18px ; border-radius: 50% ; border : 2px solid #ccc ; padding : 4px ; display : block ; left : 0 ; top : 11px ; position : absolute ; box-sizing: border-box; } .sex input[type= 'radio' ]:checked+em i{ background- clip : content-box; background-color : #0079FE ; border : 2px solid #0079FE ; } |