<header>
	<button>toggle light/dark</button> ←
</header>


<article>
	
	<h1>How to throw a computer into a waste basket:</h1>
	
	<p>From beginners to advanced</p>
	
	<figure>
		<img src="https://assets.codepen.io/4543/cern-trash-can.gif">
	</figure>
	
</article>
body {
	font-family: helvetica;
}
figure {
	margin: 0; /* annoying default browser styles */
}
img {
	display: block;
	width: 100%;
	height: auto;
}


article {
	padding: 30px;
}

article figure {
	max-width: 600px;
}


body:not(.dark) { /* fjust for a quick example */
	background: white;
	color: black;
}
body:not(.dark) figure {
	/* fine */
}


body.dark {
	background: #333;
	color: white;
}

body.dark figure {
	background-color: white;
	padding: 20px;
	border-radius: 5px;
}



document.addEventListener('click', function(click) {
	
	if ( click.target.matches('button') ) {
		document.body.classList.toggle('dark');		
	}
	
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.