Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to style prev/next arrows button?

GOAL

I've been trying to modify the slick.css to fit the style I need in my site. I got the slick.css from here.

Now

  • I want to make the arrow (left + right) bigger
  • For icons, I want to use the one with no circle-border around it.
  • I like fa-chevron-right and fa-chevron-left

What have I tried ?

portion of slick.css

.slick-prev, .slick-next { position: absolute; display: block; height: 200px; width: 50px; line-height: 0; font-size: 0; cursor: pointer; background: transparent; color: transparent; top: 50%; margin-top: -10px; padding: 0; border: none; outline: none; }
.slick-prev:hover, .slick-prev:focus, .slick-next:hover, .slick-next:focus { outline: none; background: transparent; color: transparent; }
.slick-prev:hover:before, .slick-prev:focus:before, .slick-next:hover:before, .slick-next:focus:before { opacity: 1; }
.slick-prev.slick-disabled:before, .slick-next.slick-disabled:before { opacity: 0.25; }

.slick-prev:before, .slick-next:before { font-family: "slick"; font-size: 20px; line-height: 1; color: red; opacity: 0.75; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }



.slick-prev { left: -10px; top: 70px;  }
[dir="rtl"] .slick-prev { left: auto; right: -10px; top: 70px; }
.slick-prev:before { content: "←"; }
[dir="rtl"] .slick-prev:before { content: "→"; }

.slick-next { right: -10px; top: 70px; }
[dir="rtl"] .slick-next { left: -10px; top: 70px; right: auto; }
.slick-next:before { content: "→"; }
[dir="rtl"] .slick-next:before { content: "←"; }

HTML

<div class="row slick ">
// just a bunch of lists in here
</div>

Detail Photo

Here is what I have now.

enter image description here

Here is what I want to have.

enter image description here


Question

  • Can someone help me resolve this ?

    I really appreciate your consideration and time. :)

like image 774
iori Avatar asked Dec 10 '14 14:12

iori


People also ask

How do I create a next and previous button in CSS?

CSS for Previous and Next button A set of CSS properties can be used to decorate the Previous and Next buttons in the CSS. The <a> tag can be used to create the Previous Next buttons. Use margin and padding to create extra spaces for the buttons and background-color to add color to the background of the button.

How do I add a back arrow in HTML?

You can use the history. back() method to tell the browser to go back to the user's previous page. One way to use this JavaScript is to add it to the onclick event attribute of a button. Here, we create the button using a <form> element, containing an <input> element of the button type.

How do I go to next page in HTML?

Approach: To redirect from an HTML page to another page, you can use the <meta> tag by specifying the particular link in the URL attribute. It is the client-side redirection, the browsers request the server to provide another page.


3 Answers

The Basic thing is its producing arrows by content property:

.slick-prev:before, .slick-next:before { font-family: "slick"; font-size: 40px; line-height: 1; color: red; opacity: 0.75; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }   

.slick-prev:before { content: "‹"; }
[dir="rtl"] .slick-prev:before { content: "›"; }

[dir="rtl"] .slick-next { left: -10px; top: 70px; right: auto; }
.slick-next:before { content: "›"; }
[dir="rtl"] .slick-next:before { content: "‹"; }

Replace these classes and after that just play with margin and positions properties to adjust the arrows, if this didnot fix the issue send me the http://jsfiddle.net/ link i will send you the complete solution.

If want to use Font Awesome

.slick-prev:before, .slick-next:before { font-family: FontAwesome; font-size: 40px; line-height: 1; color: red; opacity: 0.75; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }   

.slick-prev:before { content: "\f053"; }
[dir="rtl"] .slick-prev:before { content: "\f054"; }

[dir="rtl"] .slick-next { left: -10px; top: 70px; right: auto; }
.slick-next:before { content: "\f054"; }
[dir="rtl"] .slick-next:before { content: "\f053"; }

For list of Font icons visit http://astronautweb.co/snippet/font-awesome/ and how to implement the font visit this thread Use font awesome icon as css content

like image 136
saqibahmad Avatar answered Sep 28 '22 15:09

saqibahmad


.slick-prev::before {
    font-family: FontAwesome;
    content: "\f0d9";
    font-size: 22px;
}  
.slick-next::before {
    font-family: FontAwesome;
    content:  "\f0da";
    font-size: 22px;        
}      
<link href="http://fontawesome.io/assets/font-awesome/css/font-awesome.css" rel="stylesheet"/>

<button type="button" class="slick-prev "></button>

<button type="button" class="slick-next "></button>
like image 28
Ilídio Martins Avatar answered Sep 28 '22 15:09

Ilídio Martins


If you are using sass you can set sass variables provided by slick.

Refer: Add custom buttons on Slick Carousel

like image 24
par Avatar answered Sep 28 '22 15:09

par