Card: Designing Audio & Video

Designing Audio & Video

The Craft of Multimedia Masters

Web design isn’t just about making videos and audio play – it’s about making them shine. With CSS, you can give your multimedia elements that special touch: elegant borders, soft shadows, or colors that harmonize with the rest of your design. This way, your media blends seamlessly into the overall aesthetic, like a piece from an artful mosaic.

However, there are limits. Native controls like play and volume buttons offer only minimal customization. If you want full control over the design, creating your own controls with HTML, CSS, and JavaScript is the way to go. This ensures your page is not only functional but also a visual masterpiece – perfectly tailored to your creative vision!

Tokens: Design audio and video in CSS

Styling Audio and Video

Elegant Multimedia Elements for Your Website

Imagine your videos and audio players as traveling bards – they need a stage that lets them shine. With a touch of CSS, you can give them elegant borders, soft shadows, and the perfect size to ensure their performance dazzles in every browser.

  • Width and Height: Define player dimensions to fit seamlessly into your layout.
  • Borders: Add a touch of elegance with stylish frames.
  • Rounded Corners: Soften the edges for a polished look.
  • Shadows: Create depth and dimension for a standout appearance.
  • Background Color: Match the player’s background to your site’s color palette.
  • Padding and Margin: Add spacing to frame the player and make it visually prominent.
  • Object-Fit: Particularly useful for videos, ensuring they fit perfectly into their container without distorting the aspect ratio.
audio,
video {
    width: 100%;
    border: 5px solid #333;
    border-radius: 10px;
    box-shadow: 0 4px 8px #0000004d;
    background-color:
        purple;
    padding: 1rem;
}

This example ensures audio and video elements are displayed stylishly, featuring full width, rounded corners, shadows, and a violet background.

HTML
<audio src="assets/media/snow-tree.mp3" type="audio/mpeg" controls loop></audio>
<video src="assets/media/yggdrasil.mp4" type="video/mp4" controls loop poster="assets/img/yggdrasil.jpg">
Your browser doesn’t support the video tag!
</video>
CSS
audio,
video {
    box-sizing: border-box;
    max-width: 100%;
    border: 2px solid #333;
    border-radius: 30px;
    box-shadow: 0 4px 8px #0000009c;
    margin: 2rem 0;
}
Scroll to Top