Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I customize the cursor for scrollbar-hover in css?

I'm using tumblr. And I use the following code to change the cursor for the main body and hover on links:

body, a { cursor:url("http://i.imgur.com/2qleX.jpg"), auto}
a:hover { cursor:url("http://i.imgur.com/IepP2.jpg"), auto}

But it doesn't seem to affect the scrollbar I have added to one of the containers, which is:

overflow-y: auto;
overflow-x: hidden;

The cursor simply changes back to the default browser cursor when I hover/click the scrollbar. How do I customize the cursor for the scrollbar???

like image 630
queue Avatar asked Feb 16 '18 05:02

queue


People also ask

How do I change my scroll bar cursor?

In order to customize the scrollbar, you have to use ::-webkit-scrollbar property. You can specify the width of the scrollbar and also set the scrollbar track or path by setting the background property. Furthermore, you can also add some hover effect on ::-webkit-scrollbar-thumb .

How do I make my cursor hover in CSS?

You can simply use the CSS cursor property with the value pointer to change the cursor into a hand pointer while hover over any element and not just hyperlink. In the following example when you place the cursor over the list item, it will change into a hand pointer instead of the default text selection cursor.

Can you style the scroll bar CSS?

As of 2020, 96% of internet users are running browsers that support CSS scrollbar styling. However, you will need to write two sets of CSS rules to cover Blink and WebKit and also Firefox browsers. In this tutorial, you will learn how to use CSS to customize scrollbars to support modern browsers.

How will you change the pointer icon when it goes over an a tag?

The default cursor for a hyperlink is "pointer". To change it, you need to specify the cursor type for your <a> element with the CSS :hover selector.


1 Answers

This code will customize the scrollbar Here I'm adding a cursor image when we hover the scrollbar This example will only work in webkit browsers like Chrome, Safari and Opera but not in Firefox or Edge/IE. This is a non-standard way.

body::-webkit-scrollbar-thumb {
  cursor:url("http://i.imgur.com/2qleX.jpg"), auto;
}
p {
  /* force scrollbar */
  height: 200vh;
}
<p></p>

and also you can customize the Scrollbar completely, Use this

body::-webkit-scrollbar {
    /*it will edit the scrollbar area*/
}

body::-webkit-scrollbar-track {
    /*it will edit the scrollbar path*/
}

body::-webkit-scrollbar-thumb {
  /*it will edit the scrollbar thumb which we use to scroll*/
}
like image 52
Salmanul Faris Avatar answered Sep 18 '22 15:09

Salmanul Faris