Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML HTML Video and Audio (Retired) Custom Media Players Polishing a Custom Skin

Alisa Trunczik
Alisa Trunczik
3,659 Points

How to style HTML video caption?

I've tried to change color of capture, but somehow it doesn't work. I've read about cues, but I guess here we need to deal with .mejs-captions-selector in mejs-treehouse.css:

.mejs-treehouse .mejs-controls {
  background: rgba(56, 64, 71, 0.98);
  height: 30px;
}

.mejs-treehouse .mejs-controls .mejs-button button {
  outline: none;
}

.mejs-treehouse .mejs-controls .mejs-captions-button {
  margin: 0 7px;
}


.mejs-treehouse .mejs-controls .mejs-captions-selector {
  background: rgba(100, 64, 71, 0.98);
  width: 100px;
  right: auto;
}

.mejs-treehouse .mejs-controls .mejs-time-rail {
  padding: 0;
}

.mejs-treehouse .mejs-controls .mejs-time-rail span {
  height: 100%;
  border-radius: 0px;
}

.mejs-treehouse .mejs-controls .mejs-time-rail .mejs-time-total,
.mejs-treehouse .mejs-controls .mejs-time-rail .mejs-time-loaded,
.mejs-treehouse .mejs-controls .mejs-time-rail .mejs-time-buffering,
.mejs-treehouse .mejs-controls .mejs-time-rail .mejs-time-handle {
  background: #2d3339;
  margin: 0;
}

.mejs-treehouse .mejs-controls .mejs-time-rail .mejs-time-current {
  background: #ff9900;
}

.mejs-container .mejs-controls .mejs-time-rail .mejs-time-total .mejs-time-float {
  border: none;
  background: none;
  text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.8);
  font-family: Helvetica, Arial;
  font-size: 13px;
  color: #FFF;
}

Please, help me to understand how to change color of caption in our case.

1 Answer

Jenny Veens
Jenny Veens
10,896 Points

If you inspect the element in the browser, you'll see the element you want to target is:

.mejs-layers .mejs-captions-layer .mejs-captions-position .mejs-captions-text {
     color: #newcolor;
}
Alisa Trunczik
Alisa Trunczik
3,659 Points

Thank you so much, I managed it with inspection and now I finally understood!