O'Reilly logo

Mastering Sass by Luke Watts

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testimonials

The testimonials component is very similar to our image banner component. That means we can use the exact same function to ensure our text color is always the absolute contrast of the overlay color.

Open the scss/component/_testimonials.scss file and add the following:

.testimonial { 
    max-width: 20em; 
    margin: 0 auto; 
 
    @include media-centered($img: rounded, $color: abs-contrast-color(
    get($testimonials, overlay-color)));

    blockquote, cite {

        color: abs-contrast-color(get($testimonials, overlay-color));

    } 
 
    &s { 
        ... 
    } 
} 

As you can probably guess, the text will all be white now seeing as the overlay is dark:

Testimonials

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required