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 49 50 51 52 53 54 55 56 57 58 59 |
<style> label { /*display: inline-block;*/ cursor: pointer; position: relative; /*padding-left: 25px;*/ margin-right: 15px; /*font-size: 13px;*/ } /*.wrapper { width: 500px; margin: 50px auto; }*/ input[type=radio], input[type=checkbox] { display: none; } label:before { content: ""; display: inline-block; width: 16px; height: 16px; margin-right: 10px; position: absolute; left: 0; bottom: 1px; background-color: #aaa; box-shadow: inset 0px 2px 3px 0px rgba(0, 0, 0, .3), 0px 1px 0px 0px rgba(255, 255, 255, .8); } .radio label:before { border-radius: 8px; } .checkbox label { margin-bottom: 10px; } .checkbox label:before { border-radius: 3px; } input[type=radio]:checked + label:before { content: "\2022"; color: #f3f3f3; font-size: 30px; text-align: center; line-height: 18px; } input[type=checkbox]:checked + label:before { content: "X"; /* Значение для чекбокса стояло \2713 */ text-shadow: 1px 1px 1px rgba(0, 0, 0, .2); font-size: 15px; color: #f3f3f3; text-align: center; line-height: 15px; } </style> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<h1>Стилизация элементов Radio и Checkbox на CSS3</h1> <h3>Элементы Radio</h3> <div class="radio"> <input id="male" type="radio" name="gender" value="male"> <label for="male">Мужчина</label> <input id="female" type="radio" name="gender" value="female"> <label for="female">Женщина</label> </div> <h3>Элементы Checkbox</h3> <div class="checkbox"> <input id="check1" type="checkbox" name="check" value="check1"> <label for="check1">No. 1</label> <br> <input id="check2" type="checkbox" name="check" value="check2"> <label for="check2">No. 2</label> </div> |
| Категория: CSS, HTML, Вёрстка
| Тэги: CSS / HTML