Input не переключается в активное состояние
Кастомизирую инпут-чекбокс, но что-то упускаю и он как-будто не переключается в состояние "checked"
.publications {
padding: 80px 0;
background: #cacaca;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}
.container {
margin: 0 auto;
padding: 0 50px;
max-width: 1700px;
}
.publications__input:checked,
.publications__input:not(:checked) {
position: absolute;
left: -9999px;
}
.publications__input:checked+.publications__label,
.publications__input:not(:checked)+.publications__label {
display: inline-block;
position: relative;
padding-left: 28px;
line-height: 20px;
cursor: pointer;
}
.publications__input:checked+.publications__label:before,
.publications__input:not(:checked)+.publications__label:before {
content: "";
position: absolute;
left: 0px;
top: 0px;
width: 18px;
height: 18px;
border: 1px solid #dddddd;
background-color: #ffffff;
}
.publications__input:checked+.publications__label:before,
.publications__input:not(:checked)+.publications__label:before {
border-radius: 2px;
}
.publications__input:checked+.publications__label:after,
.publications__input:not(:checked)+.publications__label:after {
content: "";
position: absolute;
-webkit-transition: all 0.2s ease;
-moz-transition: all 0.2s ease;
-o-transition: all 0.2s ease;
transition: all 0.2s ease;
}
.publications__input:checked+.publications__label:after,
.publications__input:not(:checked)+.publications__label:after {
left: 3px;
top: 4px;
width: 10px;
height: 5px;
border-radius: 1px;
border-left: 4px solid #e145a3;
border-bottom: 4px solid #e145a3;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.publications__input:not(:checked)+.publications__label:after {
opacity: 0;
}
.publications__input:checked+.publications__label:after {
opacity: 1;
}
<section class="publications">
<div class="container">
<h2 class="subheading white-font">Издания</h2>
<h3>Категории</h3>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-bestsellers">
<label class="publications__label" for="input-bestsellers">Бестселлеры</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-art">
<label class="publications__label" for="input-art">Искусство</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-architecture">
<label class="publications__label" for="input-architecture">Архитектура</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-design">
<label class="publications__label" for="input-design">Дизайн</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-fashion">
<label class="publications__label" for="input-fashion">Мода</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-for-kids">
<label class="publications__label" for="input-for-kids">Детям</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-fiction">
<label class="publications__label" for="input-fiction">Художественная литература</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-journalism">
<label class="publications__label" for="input-journalism">Публицистика</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-travel-guides">
<label class="publications__label" for="input-travel-guides">Путеводители</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-philosophy">
<label class="publications__label" for="input-philosophy">Философия</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-manual">
<label class="publications__label" for="input-manual">Учебная литература</label>
</div>
<div class="publications__input-inner">
<input class="publications__input" type="checkbox" name="" id="input-newspapers">
<label class="publications__label" for="input-newspapers">Журналы и газеты</label>
</div>
</div>
</section>
Ответы (1 шт):
Автор решения: Qwertiy
→ Ссылка
<input ... id="input-bestsellers" <label ... for="input-architecture"
А с чего бы ему переключаться?