Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <div class="bg"></div>
<div class="container">
  <h1>Hover over the links</h1>
  But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will <a data-bg="" href="" target="_blank">freedom</a> you a account of the system, and expound the actual teachings of the great of the truth, <a data-bg="" href="" target='_blank'>travel</a> master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is, but <a data-bg="" href="" target="_blank">explore</a> those who do not know how to pursue pleasure rationally encounter consequences that are <a data-bg="" href="" target="_blank">holidays</a> painful. 

<footer class="page-footer">
  <small>Made with <span>❤</span> by <a href="" target="_blank">George Martsoukos</a>


                /* RESET RULES
–––––––––––––––––––––––––––––––––––––––––––––––––– */
:root {
  --red: firebrick;
  --white: white;

* {
  padding: 0;
  margin: 0;

a {
  color: inherit;
  text-decoration: none;

body {
  font: 22px/1.5 sans-serif;

h1 {
  text-align: center;
  margin: 20px 0;

–––––––––––––––––––––––––––––––––––––––––––––––––– */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 10px;

.container a {
  position: relative;
  border-bottom: 2px dashed var(--red);
  transition: all 0.2s;

.container a::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  min-height: 30px;
  transform: translate(-50%, -50%) scaleX(0);
  padding: 10px;
  z-index: -1;
  transform-origin: 50%;
  background: var(--white);

.bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 0;
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  transition: all 0.3s ease-out;

.bg-show .bg {
  z-index: 1;
  opacity: 1;

.bg-show a:hover {
  z-index: 2;
  border-bottom-color: transparent;
  color: var(--red);

.bg-show .container a:hover::before {
  transform: translate(-50%, -50%) scaleX(1);
  transition: transform 0.2s 0.1s ease-out;

–––––––––––––––––––––––––––––––––––––––––––––––––– */
.page-footer {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  font-size: 13px;

.page-footer span {
  color: var(--red);


                const links = document.querySelectorAll(".container a");
const bg = document.querySelector(".bg");
const showClass = "bg-show";

for (const link of links) {
  const img = new Image();
  img.src =;

  link.addEventListener("mouseenter", function() { = `url(${})`;

  link.addEventListener("mouseleave", () => {