content-cards
intermediate
music
player
cards
modern
interactive
Category · Content Cards Difficulty Level · Intermediate Published on · August 18, 2025

Card-Style Music Player

A modern card-based music player interface with album artwork, interactive controls, and smooth animations.

#music #player #cards #modern #interactive

Responsive Design

Yes

Dark Mode Support

Yes

lines

1010

Browser Compatibility

Chrome · Firefox · Safari · Edge

Live Preview

Interact with the component without leaving the page.

600px

Overview

A modern card-based music player interface with album artwork, interactive controls, and smooth animations.

How to use

  1. Copy the HTML markup into your page.
  2. Paste the CSS into your stylesheet and ensure the selectors match your markup.
  3. Paste the JavaScript and load it after the markup.
  4. Adjust spacing, colors, and text to match your design system.

Customization tips

  • Rename class names to avoid collisions with your existing CSS.
  • Replace hard-coded colors with CSS variables for theming.
  • Verify the layout at 320px, 768px, and 1024px widths.
  • Test dark mode with your preferred background and text colors.

HTML

214

lines

CSS

543

lines

JavaScript

253

lines


                <div class="card-music-player">
  <div class="player-header">
    <h1 class="player-title">My Music</h1>
    <div class="player-stats">
      <span class="total-songs">24 songs</span>
      <span class="total-duration">1h 32m</span>
    </div>
  </div>
  
  <div class="now-playing-card">
    <div class="album-art-container">
      <div class="album-art">
        <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cdefs%3E%3ClinearGradient id='grad1' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' style='stop-color:%23ff6b6b;stop-opacity:1' /%3E%3Cstop offset='100%25' style='stop-color:%234ecdc4;stop-opacity:1' /%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='200' height='200' fill='url(%23grad1)'/%3E%3Ccircle cx='100' cy='100' r='60' fill='%23fff' opacity='0.2'/%3E%3Ccircle cx='100' cy='100' r='20' fill='%23333'/%3E%3C/svg%3E" alt="Album Cover">
        <div class="play-overlay">
          <button class="main-play-btn" id="main-play-btn">
            <svg class="play-icon" viewBox="0 0 24 24" fill="currentColor">
              <path d="M8 5v14l11-7z"/>
            </svg>
            <svg class="pause-icon" viewBox="0 0 24 24" fill="currentColor" style="display: none;">
              <path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/>
            </svg>
          </button>
        </div>
      </div>
      <div class="vinyl-effect"></div>
    </div>
    
    <div class="track-info">
      <h2 class="track-title" id="current-track-title">Midnight Dreams</h2>
      <p class="track-artist" id="current-track-artist">Luna & The Stars</p>
      <div class="track-details">
        <span class="album-name">Cosmic Vibes</span>
        <span class="release-year">2024</span>
      </div>
    </div>
    
    <div class="progress-section">
      <div class="time-display">
        <span id="current-time">2:34</span>
        <span id="total-time">4:12</span>
      </div>
      <div class="progress-bar-container">
        <div class="progress-bar" id="progress-bar">
          <div class="progress-fill" id="progress-fill"></div>
          <div class="progress-handle" id="progress-handle"></div>
        </div>
      </div>
    </div>
    
    <div class="player-controls">
      <button class="control-btn" id="shuffle-btn" aria-label="Shuffle">
        <svg viewBox="0 0 24 24" fill="currentColor">
          <path d="M10.59 9.17L5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41l-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z"/>
        </svg>
      </button>
      
      <button class="control-btn" id="prev-btn" aria-label="Previous">
        <svg viewBox="0 0 24 24" fill="currentColor">
          <path d="M6 6h2v12H6zm3.5 6l8.5 6V6z"/>
        </svg>
      </button>
      
      <button class="control-btn play-pause-btn" id="play-pause-btn" aria-label="Play/Pause">
        <svg class="play-icon" viewBox="0 0 24 24" fill="currentColor">
          <path d="M8 5v14l11-7z"/>
        </svg>
        <svg class="pause-icon" viewBox="0 0 24 24" fill="currentColor" style="display: none;">
          <path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/>
        </svg>
      </button>
      
      <button class="control-btn" id="next-btn" aria-label="Next">
        <svg viewBox="0 0 24 24" fill="currentColor">
          <path d="M6 18l8.5-6L6 6v12zM16 6v12h2V6h-2z"/>
        </svg>
      </button>
      
      <button class="control-btn" id="repeat-btn" aria-label="Repeat">
        <svg viewBox="0 0 24 24" fill="currentColor">
          <path d="M7 7h10v3l4-4-4-4v3H5v6h2V7zm10 10H7v-3l-4 4 4 4v-3h12v-6h-2v4z"/>
        </svg>
      </button>
    </div>
    
    <div class="volume-section">
      <button class="control-btn" id="volume-btn" aria-label="Volume">
        <svg viewBox="0 0 24 24" fill="currentColor">
          <path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/>
        </svg>
      </button>
      <div class="volume-slider">
        <input type="range" id="volume-slider" min="0" max="100" value="75">
        <div class="volume-fill"></div>
      </div>
    </div>
  </div>
  
  <div class="playlist-section">
    <h3 class="playlist-title">Up Next</h3>
    <div class="music-cards-container">
      <div class="music-card active" data-title="Midnight Dreams" data-artist="Luna & The Stars" data-album="Cosmic Vibes" data-duration="4:12">
        <div class="card-album-art">
          <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cdefs%3E%3ClinearGradient id='grad2' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' style='stop-color:%23ff6b6b;stop-opacity:1' /%3E%3Cstop offset='100%25' style='stop-color:%234ecdc4;stop-opacity:1' /%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='80' height='80' fill='url(%23grad2)'/%3E%3Ccircle cx='40' cy='40' r='25' fill='%23fff' opacity='0.2'/%3E%3Ccircle cx='40' cy='40' r='8' fill='%23333'/%3E%3C/svg%3E" alt="Album">
          <div class="card-play-btn">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M8 5v14l11-7z"/>
            </svg>
          </div>
        </div>
        <div class="card-info">
          <h4 class="card-title">Midnight Dreams</h4>
          <p class="card-artist">Luna & The Stars</p>
          <span class="card-duration">4:12</span>
        </div>
        <div class="card-actions">
          <button class="action-btn" aria-label="Like">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
            </svg>
          </button>
          <button class="action-btn" aria-label="More">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
            </svg>
          </button>
        </div>
      </div>
      
      <div class="music-card" data-title="Stellar Waves" data-artist="Cosmic Collective" data-album="Deep Space" data-duration="3:45">
        <div class="card-album-art">
          <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cdefs%3E%3ClinearGradient id='grad3' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' style='stop-color:%236c5ce7;stop-opacity:1' /%3E%3Cstop offset='100%25' style='stop-color:%23a8e6cf;stop-opacity:1' /%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='80' height='80' fill='url(%23grad3)'/%3E%3Ccircle cx='40' cy='40' r='25' fill='%23fff' opacity='0.2'/%3E%3Ccircle cx='40' cy='40' r='8' fill='%23333'/%3E%3C/svg%3E" alt="Album">
          <div class="card-play-btn">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M8 5v14l11-7z"/>
            </svg>
          </div>
        </div>
        <div class="card-info">
          <h4 class="card-title">Stellar Waves</h4>
          <p class="card-artist">Cosmic Collective</p>
          <span class="card-duration">3:45</span>
        </div>
        <div class="card-actions">
          <button class="action-btn" aria-label="Like">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
            </svg>
          </button>
          <button class="action-btn" aria-label="More">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
            </svg>
          </button>
        </div>
      </div>
      
      <div class="music-card" data-title="Neon Nights" data-artist="Synthwave Society" data-album="Retro Future" data-duration="5:28">
        <div class="card-album-art">
          <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cdefs%3E%3ClinearGradient id='grad4' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' style='stop-color:%23fd79a8;stop-opacity:1' /%3E%3Cstop offset='100%25' style='stop-color:%23fdcb6e;stop-opacity:1' /%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='80' height='80' fill='url(%23grad4)'/%3E%3Ccircle cx='40' cy='40' r='25' fill='%23fff' opacity='0.2'/%3E%3Ccircle cx='40' cy='40' r='8' fill='%23333'/%3E%3C/svg%3E" alt="Album">
          <div class="card-play-btn">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M8 5v14l11-7z"/>
            </svg>
          </div>
        </div>
        <div class="card-info">
          <h4 class="card-title">Neon Nights</h4>
          <p class="card-artist">Synthwave Society</p>
          <span class="card-duration">5:28</span>
        </div>
        <div class="card-actions">
          <button class="action-btn liked" aria-label="Unlike">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
            </svg>
          </button>
          <button class="action-btn" aria-label="More">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
            </svg>
          </button>
        </div>
      </div>
      
      <div class="music-card" data-title="Ocean Breeze" data-artist="Ambient Collective" data-album="Nature Sounds" data-duration="6:15">
        <div class="card-album-art">
          <img src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cdefs%3E%3ClinearGradient id='grad5' x1='0%25' y1='0%25' x2='100%25' y2='100%25'%3E%3Cstop offset='0%25' style='stop-color:%2300b894;stop-opacity:1' /%3E%3Cstop offset='100%25' style='stop-color:%2300cec9;stop-opacity:1' /%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='80' height='80' fill='url(%23grad5)'/%3E%3Ccircle cx='40' cy='40' r='25' fill='%23fff' opacity='0.2'/%3E%3Ccircle cx='40' cy='40' r='8' fill='%23333'/%3E%3C/svg%3E" alt="Album">
          <div class="card-play-btn">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M8 5v14l11-7z"/>
            </svg>
          </div>
        </div>
        <div class="card-info">
          <h4 class="card-title">Ocean Breeze</h4>
          <p class="card-artist">Ambient Collective</p>
          <span class="card-duration">6:15</span>
        </div>
        <div class="card-actions">
          <button class="action-btn" aria-label="Like">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
            </svg>
          </button>
          <button class="action-btn" aria-label="More">
            <svg viewBox="0 0 24 24" fill="currentColor">
              <path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
            </svg>
          </button>
        </div>
      </div>
    </div>
  </div>
</div>

              
214lines
11816characters
HTMLLanguage

Browser Compatibility

Chrome

>= 60

Firefox

>= 55

Safari

>= 10

Edge

>= 15

Related Code Snippets

Explore template packs

Need larger building blocks? Browse responsive landing pages and component bundles.

Open HTML Template Library ->