I need to hide the full screen button of the video tag in HTML5. Is there any way to achieve it ?
Thanks.
To hide a video on a web page, use yourVariableName. style. display='none'.
I think you can accomplish this by changing the css for the #document fragments
, these are DOM1 specs and supported by all browsers, but about the styling, I'm not sure.
webkit
browser (chrome on windows) specific solutionThe following solution is webkit
specific
video::-webkit-media-controls-fullscreen-button { display: none; } video::-webkit-media-controls-play-button {} video::-webkit-media-controls-timeline {} video::-webkit-media-controls-current-time-display{} video::-webkit-media-controls-time-remaining-display {} video::-webkit-media-controls-mute-button {} video::-webkit-media-controls-toggle-closed-captions-button {} video::-webkit-media-controls-volume-slider {}
Here is the fiddle for it.
Warning:
webkit
e.g. Firefox or Internet Explorer, or obsolete versions of Opera that had Blink/Presto.webkit
browsers in Operating systems other than windows e.g. Safari on macOS.Update:
After multiple readers complained that the aforementioned solution did not work for certain browsers, I'm updating the answer.
-webkit-
browser specific and was tested in Chrome on Windows.about:config
page.<video>
componentElements
look for Show user agent shadow DOM optionHiding the full screen button of the video tag in HTML5
Additionally, as @paulitto suggests, DOM methods can be implemented after removing controls
attribute from <video>
element. Refer this tutorial for more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With