Я просмотрел несколько разных вопросов, помогая мне добраться до этой точки, однако я не могу понять селектор, который позволяет мне добраться до внешнего DIV
.Сделать div видимым, когда опция отмечена
Если я удалю два из DIV, код работает отлично, но с форматированием мне нужны divs, чтобы иметь возможность контролировать внешний вид. Любая помощь будет работать. Я знаю, что ~
- это дочерний селектор, поэтому он работает без DIV.
Как выбрать DIV
?
Код:
.reveal-if-active {
color: #ccc;
font-style: italic;
opacity: 0;
transform: scale(0.8);
max-height: 0px;
transition: 0.5s;
}
input#photo1:checked ~ div#portraits,
input#photo2:checked ~ div#wedding,
input#photo3:checked ~ div#other {
color: #f00;
font-style: normal;
transform: scale(1);
opacity: 1;
max-height: 150px;
}
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>
<body>
<form>
<div class="eight columns" data-scroll-reveal="enter bottom move 100px over 0.6s after 0.2s">
<label for="photo">
<span class="error" id="err-phone">Please Select What you are looking for?</span>
</label>
<input class="radio_activator_portraits" name="photo" id="photo1" type="radio" value="portraits">
<label for="photo1">Portraits</label>
<input class="radio_activator_weddings" name="photo" id="photo2" type="radio" value="wedding">
<label for="photo2">Wedding</label>
<input class="radio_activator_other" name="photo" id="photo3" type="radio" value="other">
<label for="photo3">other</label>
</div>
<div class="eight columns reveal-if-active" id="portraits" name="portraits">Portraits</div>
<div class="eight columns reveal-if-active" id="wedding" name="wedding">Wedding</div>
<div class="eight columns reveal-if-active" id="other" name="other">Other</div>
</form>
</body>
</html>
возможных дубликатов [CSS-селектор для отмеченной метки переключателя] (http://stackoverflow.com/questions/1431726/css-selector-for-a-checked-radio-buttons-label) –