CSS Portal

:muted CSS Pseudo Class

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The :muted pseudo-class in CSS is used to select media elements, typically audio and video, that are currently muted. It allows developers to style these elements differently when their sound is disabled, providing visual cues to users that the media is not producing sound. This can be particularly useful in custom media player interfaces, where muted states might need to be highlighted or indicated with specific icons, colors, or overlays.

Styling elements with :muted can involve a variety of CSS properties. For example, developers might use filter to visually dim a video or change the opacity, or border-color to highlight a muted audio track with a distinct border. While the pseudo-class itself does not change the behavior of the element, it serves as a powerful hook for UI feedback and accessibility improvements, making it easier for users to identify the state of media playback.

Here is a basic example of using :muted:

HTML

<video id="myVideo" controls muted>
  <source src="sample.mp4" type="video/mp4">
  Your browser does not support the video tag.
</video>

CSS

video:muted {
  filter: grayscale(100%);
  opacity: 0.6;
  border: 2px solid red;
}

In this example, any video element that is muted will appear in grayscale with reduced opacity and a red border. This helps users immediately recognize that the video’s audio is turned off. The :muted pseudo-class is dynamic, so if a user unmutes the media via controls or scripting, the styles will automatically revert. This makes it a convenient tool for creating responsive and interactive media experiences without additional JavaScript.

Syntax

:muted {
  /* ... */
}

Example

<div class="video-container">
<video controls muted src="audio/gromit.mp4"></video>
<p class="status-message">The audio is currently muted.</p>
</div>
/* Default styling for the video */
video {
width: 100%;
max-width: 500px;
border: 5px solid #4CAF50; /* Green border when unmuted */
transition: border 0.3s ease;
}

/* Styling applied ONLY when the video is muted */
video:muted {
border: 5px solid #f44336; /* Red border when muted */
opacity: 0.8;
}

/* Using the muted state to show/hide a message */
.status-message {
display: none;
font-family: sans-serif;
color: #f44336;
}

video:muted ~ .status-message {
display: block;
}

Browser Support

The following information will show you the current browser support for the CSS :muted pseudo class. Hover over a browser icon to see the version that first introduced support for this CSS psuedo class.

This psuedo class is supported in some modern browsers, but not all.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 31st December 2025

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!