JSFiddle - React, Tailwind, and code Playground
HTML
<button class="reveal">Show Answer </button><div class="toggle_container"><div class="block"> Explanation of Question 1 </div></div>
<br />
<button class="reveal">Show Answer </button><div class="toggle_container"><div class="block"> Explanation of Question 2 </div></div>
<br />
<button class="reveal">Show Answer</button><div class="toggle_container"><div class="block"> Explanation of Question 3</div></div>
CSS
.reveal {
display: inline-block;
white-space: nowrap;
background-color: #EDEDED;
background-image: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ccc));
background-image: -webkit-linear-gradient(top, #eee, #ccc);
background-image: -moz-linear-gradient(top, #eee, #ccc);
background-image: -ms-linear-gradient(top, #eee, #ccc);
background-image: -o-linear-gradient(top, #eee, #ccc);
background-image: url('linear-gradient(top,%20#eee, #ccc');
border: 1px solid #777;
margin: 0.25em;
text-decoration: none;
color: #333;
text-shadow: 0 1px 0 rgba(255,255,255,.8);
-moz-border-radius: .1em;
-webkit-border-radius: .1em;
border-radius: .1em;
-moz-box-shadow: 0 0 1px 1px rgba(255,255,255,.8) inset, 0 1px 0 rgba(0,0,0,.3);
-webkit-box-shadow: 0 0 1px 1px rgba(255,255,255,.8) inset, 0 1px 0 rgba(0,0,0,.3);
box-shadow: 0 0 1px 1px rgba(255,255,255,.8) inset, 0 1px 0 rgba(0,0,0,.3); font-style:normal; font-variant:normal; font-weight:bold; line-height:2em; font-size:1em; font-family:Arial, Helvetica; padding-left:0.5em; padding-right:0.5em; padding-top:0; padding-bottom:0
}
.show_reveal:hover
{
background-color: #eee;
background-image: -webkit-gradient(linear, left top, left bottom, from(#fafafa), to(#ddd));
background-image: -webkit-linear-gradient(top, #fafafa, #ddd);
background-image: -moz-linear-gradient(top, #fafafa, #ddd);
background-image: -ms-linear-gradient(top, #fafafa, #ddd);
background-image: -o-linear-gradient(top, #fafafa, #ddd);
background-image: url('linear-gradient(top,%20#fafafa, #ddd');
}
.show_reveal:active
{
-moz-box-shadow: 0 0 4px 2px rgba(0,0,0,.3) inset;
-webkit-box-shadow: 0 0 4px 2px rgba(0,0,0,.3) inset;
box-shadow: 0 0 4px 2px rgba(0,0,0,.3) inset;
...
JavaScript
$(document).ready(function(){
$(".toggle_container").hide();
$("button.reveal").click(function(){
$(this).toggleClass("active").next().slideToggle("fast");
return false;
});
$("a[href='" + window.location.hash + "']").parent(".reveal").click();
});