Подскажите селектор
Есть такой html:
<div class="cards" > <div class="slide">menu</div> <input type="checkbox" id="toggle"> </div> Нужно при нажатии на чекбокс, чтобы к корневому div'у (у которого class==cards) применялся css. Код:
input[type=checkbox]:checked selector { |
Цитата:
Селекторы работают только "вниз"... |
torsar,
input заменить на label и перенести в строку ноль |
Цитата:
Жалко, что нету такого хитрого селектора :( |
torsar,
<!DOCTYPE html> <html> <head> <title>Untitled</title> <meta charset="utf-8"> <style type="text/css"> input[type=checkbox]:checked + .cards { color: red; } #toggle{ display: none; } input[type=checkbox]:checked + .cards label:before { content: "\2713"; color: #008000; padding:1px 3px; } [for="toggle"]:before { border-radius: 3px; padding: 1px 8px; content: " "; text-shadow: 1px 1px 1px rgba(0, 0, 0, .2); font-size: 15px; border: 2px solid #696969; text-align: center; line-height: 15px; } </style> </head> <body> <input type="checkbox" id="toggle"> <div class="cards" > <div class="slide">menu</div> <label for="toggle"></label> </div> </body> </html> |
Часовой пояс GMT +3, время: 23:10. |