<center><div class="divspoiler">
<input type="button" value="Mostrar" onclick="if (this.parentNode.nextSibling.childNodes[0].style.display != '') { this.parentNode.nextSibling.childNodes[0].style.display = ''; this.value = 'Ocultar'; } else { this.parentNode.nextSibling.childNodes[0].style.display = 'none'; this.value = 'Mostrar'; }" />
</div><div><div class="spoiler" style="display: none;"><br/>
<!-- Adentro de este comentario el contenido a ocultar/mostrar -->
<img src='http://www.w3.org/html/logo/downloads/HTML5_Logo_512.png' width='400px'/>
<!-- Adentro de este comentario el contenido a ocultar/mostrar -->
</div></div></center>
CSS
/*Opcional */
.divspoiler input{
background: #333; /* Aqui va el color de fondo del boton */
border: none; /* Selecciona none para que no tenga border, o elimina la liena para que tenga borde */
border-radius: 3px; /* Las esquinas redondeadas */
width: 60px; /* El ancho del boton (opcional) */
height: 25px; /* El alto del boton (opcional) */
color: #fff; /* El color del texto */
cursor: pointer; /* Forma del cursor */
font-family: sans-serif; /* Fuente del texto */
font-weight: bold;
}
JavaScript
//No necesita
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.