Nice input checkbox

Рарзметка HTML:


Пункт 1



Пункт 2


Пункт 3 с ошибкой

Стили CSS:

.nice_input_checkbox {
	display: inline-block;
	margin-right: 20px;
	vertical-align: middle;
}
.nice_input_checkbox input {
	display: none;
}
.nice_input_checkbox i {
	position: relative;
	display: block;
	width: 20px;
	height: 20px;
	border-radius: 3px;
	background-color: #f8f6f6;
	border: 1px solid #eae4e5;
	-webkit-box-shadow: inset 0 1px 1px #eae4e5;
	-moz-box-shadow: inset 0 1px 1px #eae4e5;
	box-shadow: inset 0 1px 1px #eae4e5;
}
.nice_input_checkbox:checked i{
  border:1px solid #ccc;
}
.nice_input_checkbox input:checked + i:after{
  content: '';
  position: absolute;
  width: 100%;
  left: 0;
  height: 100%;
  background-position: 50%;
  background-size: 12px;
  background-repeat: no-repeat;
  background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTYuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgd2lkdGg9IjE2cHgiIGhlaWdodD0iMTZweCIgdmlld0JveD0iMCAwIDQ0Mi41MzMgNDQyLjUzMyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNDQyLj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kbox.error input + i:before, .nice_input_checkbox input.haserror + i:before {
	content: '';
	position: absolute;
	z-index: 1;
	width: 60px;
	height: 60px;
	top: -21px;
	left: -21px;
	background: rgba(233, 86, 64, 0.18);
	border-radius: 100%;
}

Скрипты JS:

$(".nice_input_checkbox").find("input").change(function(){
  $(this).removeClass("haserror");
});

Результат:

Пункт 1


Пункт 2


Пункт 3 с ошибкой
Способ поблагодарить автора сайта:

Комментарии (0)

  1. Напишите первый комментарий
*Комментарий будет опубликован после проверки модератором