Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Main .css isnt overriding the slick plugin css file !!!

.slick-dots li button:before{
    font-size:16px;
    color:white;
  }

the dots isnt styling !!! https://teamtreehouse.com/library/using-jquery-plugins/using-a-jquery-carousel/the-carousel-challenge-solution

My main.css file doesnt respond to any changes it doesnt overide anything nothing change in the style unless i change it from the (slick-theme.css) please any help with that!!!!

Sam Gord
Sam Gord
14,084 Points

first be sure to load your main.css after the slick-theme.css file , that's the main rule of overriding styles. then i'm having a suggestion for you for slick CUSTOM DOTS, look at this setup here -->

  $('.quotes__slider').slick({
    autoplay: true,
    dots: true,
    appendDots: $('.quotes__controles'),
    dotsClass: 'quotes__controls__dots',
    arrows: false,
    slidesToShow: 2,
    draggable: false,
    mobileFirst: true,
    // this function is for customizing slider buttons
    customPaging: function (slider, i) {
      var slideNumber = (i + 1),
        totalSlides = slider.slideCount;
      return '<a class="dot" role="button" title="' + slideNumber + ' of ' + totalSlides + '"><span class="string">' + slideNumber + '/' + totalSlides + '</span></a>';
    },
    responsive: [{
        breakpoint: 600,
        settings: {
          slidesToShow: 2
        }
      },
      {
        breakpoint: 300,
        settings: {
          slidesToShow: 1
        }
      }
    ],

  });

here i made an empty <div class="quotes__controles"></div> so i can append my custom dots in it. then put your attention on that function that customizes the slider buttons, you can just copy and paste it into your code its not complicated though . and then you can style your dots like this -->

  quotes__controles {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    &__dots {
      display: flex;
      justify-content: space-between;
      li {
        margin: rem(5);
      }
      .dot {        
        background: color(white);
        display: block;
        width: rem(20);
        height: rem(20);
        border-radius: 50%;
        cursor: pointer;
        transition: all .15s;
        .string {
          display: none;
        }
      }
      .slick-active .dot {
        background: color(yellow);
      }
    }
  }

1 Answer

Thanks a lot sam :)

Sam Gord
Sam Gord
14,084 Points

you are very welcome , glad i could help , btw now that i read my solution again, a little more explanation comes to my mind. if by any chance the CSS looks not familiar to you i have to say that its SCSS a preprocessor to CSS , and those rem(20) and color(yellow) are just functions made with SCSS , read em like this --> rem(20) --> 20px color(yellow) --> yellow

happy coding ;)