I need the pagination and arrows to be green.
How can I override the default blue colour in these elements?
This is what I’m working with:
CSS
html,
body {
position: relative;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
swiper-container {
width: 100%;
height: 100%;
}
swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
display: flex;
justify-content: center;
align-items: center;
}
swiper-slide img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
swiper-container {
margin-left: auto;
margin-right: auto;
}
HTML
html,
body {
position: relative;
height: 100%;
}
body {
background: #eee;
font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
font-size: 14px;
color: #000;
margin: 0;
padding: 0;
}
swiper-container {
width: 100%;
height: 100%;
margin-left: auto;
margin-right: auto;
}
swiper-slide {
text-align: center;
font-size: 18px;
background: #fff;
display: flex;
justify-content: center;
align-items: center;
}
swiper-slide img {
display: block;
width: 100%;
height: 100%;
object-fit: cover;
}
.swiper-button-next, .swiper-button-prev {
color: #ccc !important;
}
<swiper-container class="mySwiper" pagination="true" pagination-clickable="true" navigation="true" space-between="30"
loop="true">
<swiper-slide>Slide 1</swiper-slide>
<swiper-slide>Slide 2</swiper-slide>
<swiper-slide>Slide 3</swiper-slide>
<swiper-slide>Slide 4</swiper-slide>
<swiper-slide>Slide 5</swiper-slide>
<swiper-slide>Slide 6</swiper-slide>
<swiper-slide>Slide 7</swiper-slide>
<swiper-slide>Slide 8</swiper-slide>
<swiper-slide>Slide 9</swiper-slide>
</swiper-container>
<script src="https://cdn.jsdelivr.net/npm/swiper@10/swiper-element-bundle.min.js"></script>
2
Answers
Swiper uses CSS Variables to set colours.
So all you need to do is declare –swiper-navigation-color and –swiper-pagination-color in the :root of your CSS
You can style the :after pseudo-element of the buttons like this: