Forum Moderators: open
label {
display:block;
margin:20px 0 0;
border-bottom:1px solid green;
}
label:hover { text-decoration:underline }
input {
position:absolute;
left:-999em
}
.hide {
width:50%;
border:1px solid #000;
background:lightblue;
max-height:999em;
opacity:1;
height:auto;
overflow:hidden;
#transition:opacity .5s linear;
}
.hide p {
padding:10px;
margin:0
}
input[type=checkbox]:checked + div {
opacity:0;
max-height:0;
border:none;
#transition:opacity .5s linear, max-height .5s linear;
}
.follow{border-top:1px solid blue;margin:0}
<div>
<label for="item-1">FAQ Number 1</label>
<input type="checkbox" name="one" id="item-1" checked>
<div class="hide">
<p>Answer to FAQ Number 1.
<ul>
<li>This is the first div test.</li>
<li>To make a div initially display, remove CHECKED form the input checkbox.</li>
<li>To make a div show initially hidden, add CHECKED to the checkbox as done above.</li>
</ul>
</p>
</div>
<label for="item-2">FAQ Number 2</label>
<input type="checkbox" name="two" id="item-2" checked>
<div class="hide">
<p>Answer to FAQ Number 2. Second div test</p>
</div>
<label for="item-3">FAQ Number 3</label>
<input type="checkbox" name="three" id="item-3" checked>
<div class="hide">
<p>Answer to FAQ Number 3, this is the third div test</p>
</div>
<p class="follow">Following the FAQs...</p>
</div>
Anyone know if HOVER could be used to toggle the checkbox without using javascript, just CSS and HTML?
<div>
<div class="faq-item">
<label for="item-1">FAQ Number 1</label>
<input type="checkbox" name="one" id="item-1" checked>
<div class="hide">
<p>Answer to FAQ Number 1.
<ul>
<li>This is the first div test.</li>
<li>To make a div initially display, remove CHECKED form the input checkbox.</li>
<li>To make a div show initially hidden, add CHECKED to the checkbox as done above.</li>
</ul>
</p>
</div>
</div>
<div class="faq-item">
<label for="item-2">FAQ Number 2</label>
<input type="checkbox" name="two" id="item-2" checked>
<div class="hide">
<p>Answer to FAQ Number 2. Second div test</p>
</div>
</div>
<div class="faq-item">
<label for="item-3">FAQ Number 3</label>
<input type="checkbox" name="three" id="item-3" checked>
<div class="hide">
<p>Answer to FAQ Number 3, this is the third div test</p>
</div>
</div>
<p class="follow">Following the FAQs...</p>
</div>
label {
display:block;
margin:20px 0 0;
border-bottom:1px solid green;
}
label:hover { text-decoration:underline }
input {
position:absolute;
left:-999em
}
.hide,
.faq-item:hover .hide {
width:50%;
border:1px solid #000;
background:lightblue;
max-height:999em;
opacity:1;
height:auto;
overflow:hidden;
#transition:opacity .5s linear;
}
.hide p {
padding:10px;
margin:0
}
input[type=checkbox]:checked + div {
opacity:0;
max-height:0;
border:none;
transition:opacity .5s linear, max-height .5s linear;
}
.follow{border-top:1px solid blue;margin:0}
Hover can apply to any element ... at least in HTML5
li.dropmenu form {display: none;}
li.dropmenu:hover > form {display: block;}
Clearly it can't have been very traumatic, since I'd forgotten all about it :)