Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

HTML

              
                <div class="video-container">
    <a href="https://www.youtube.com/watch?v=dQw4w9WgXcQ" target="_blank" class="video-link">
        <img src="https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg" alt="YouTube Thumbnail" class="video-thumbnail">
        <div class="play-rectangle">
            <svg width="30" height="30" viewBox="0 0 24 24" fill="white" xmlns="http://www.w3.org/2000/svg" class="play-button">
                <path d="M8 5v14l11-7z"></path>
            </svg>
        </div>
    </a>
    <div class="video-title">
        <div>Rick Astley, Rickrolling for Fun</div>
    </div>
</div>

              
            
!

CSS

              
                .video-container {
    position: relative;
    width: 560px;
    height: 315px;
    background: white;
    overflow: hidden;
}

.video-link {
    display: inline-block;
    width: 100%;
    height: 100%;
}

.video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border: 0;
}

.play-rectangle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    width: 60px;
    height: 40px;
    transition: background 0.5s;
}

.video-title {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7);
    overflow: hidden;
    padding: 5px;
}

.video-title div {
    position: relative;
    display: inline-block;
    white-space: nowrap; 
    color: white;
    font-size: 15px;
    font-family: Verdana, sans-serif; 
    animation: marquee 10s linear infinite; /* Endlose Schleife */
}

@keyframes marquee {
    0% {
        left: 100%; /* Start außerhalb des Sichtbereichs rechts */
        transform: translate(0%, 0); /* Keine Verschiebung am Anfang */
    }
    100% {
        left: 0%; /* Ende in der Sichtbarkeit */
        transform: translate(-100%, 0); /* Verschiebt den Text nach links */
    }
}

/* Rechteck wird rot, wenn über das Thumbnail oder das Rechteck gehovert wird */
.video-link:hover .play-rectangle {
    background: rgba(255, 0, 0, 0.8); /* Rechteck wird rot */
}

.play-button {
    transition: transform 0.5s; /* Übergangszeit für das Dreieck */
    width: 100%;
    height: 100%;
    transform: scale(0.5);
}

/* Vergrößert das Dreieck, wenn über das Rechteck oder den Pfeil gehovert wird */
.play-rectangle:hover .play-button,
.play-button:hover {
    transform: scale(0.8); /* Vergrößert das Dreieck bei Hover */
}

/* Media Query zur Überprüfung der Bewegungsanpassungen */
@media (prefers-reduced-motion: no-preference) {
    .video-title div {
        animation: marquee 15s linear infinite; /* Aktiviert die Animation nur für Benutzer, die keine Bewegungsreduzierung bevorzugen */
    }
}

              
            
!

JS

              
                
              
            
!
999px

Console