I set out to style my captions to have a black background and be positioned below the video for Safari and Chrome. I have achieved success with the following code combined with editing the .vtt file with the following styles. Note you must add the styles to the .vtt file or else in safari your captions will jump around when the video controls (even if they're hidden) would appear:
4
00:00:09.980 --> 00:00:12.640 line:13 position:50% align:middle
size:100%
for just the summer but I ended up staying here.
Styles for chrome and safari captions:
Chrome uses the video::cue background-color and opacity.
video::cue {
opacity: 1;
background-color: black;
font-size: 20px !important;
}
Safari uses -webkit-media-text-track-display-backdrop for it's background color. Note the !important which overrides Safari's inherent styling.
video::-webkit-media-text-track-display-backdrop {
background-color: black !important;
overflow: visible !important;
}
The following webkit-media-text-track-display overflow is allow for more padding around Chrome's caption text:
video::-webkit-media-text-track-display {
overflow: visible !important;
}
Overflow visible is important on the following code for Safari and I'm setting the captions below the video with the transform, which is reliant on a fixed font-size:
video::-webkit-media-text-track-container {
overflow: visible !important;
transform: translateY(30%) !important;
}