Customizing the appearance of the webkit scrollbar while preserving the functionality of the webkit res

Struggling with the styling of the scrollbar without affecting the resizer. Successfully styled the scrollbar but facing an issue where the resizer changes size and gains an unintended border. The resizer looks fine when there's no scrollbar present. Images for reference: Codepen link.

https://i.sstatic.net/6RHJY.png https://i.sstatic.net/Uv6Cj.png

The code in my.scss file is as follows:

@mixin scrollbar-styles {
  &::-webkit-scrollbar {
    background-color: transparent;
    border: none;
    width: 12px;
  }

  &::-webkit-scrollbar-button {
    display: none;
  }

  &:hover {
    &::-webkit-scrollbar-thumb {
      background-color: rgba(0, 0, 0, 0.3);
      border-radius: 99px;
      background-clip: content-box;
      border: 3px solid transparent;
    }
    &.on-dark {
      &::-webkit-scrollbar-thumb {
        background-color: rgba(255, 255, 255, 0.3);
      }
    }
  }
}

Seeking assistance on fixing this issue. Attempts with ::-webkit-resizer have failed and it's not recommended by MDN. Visit link for more details.

Appreciate any help. Thank you!

Answer №1

The challenge lies in the fact that there are actually two pseudo elements at play here.

::webkit-resizer is responsible for resizing, while ::webkit-scrollbar-corner represents the corner that appears when both a scrollbar and a resizer are present (check out examples here and here).

To eliminate the strange border effect, you need to style the ::webkit-scrollbar-corner as well:

::-webkit-scrollbar-corner {
    background-color: transparent;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

html2canvas does not support integration with asp.net

Feeling a bit lost here. I've been reassured that the jquery code below is solid, but for some reason html2canvas just won't cooperate. When I click the button, nothing happens at all. Other methods with the button seem to work fine. Can anyone s ...

Looking to create multiple image popups for different models using JavaScript? I am currently utilizing the W3Schools model image for this purpose

I am having trouble getting multiple image models to display, as only one pop-up is appearing. Can someone please assist me in figuring out how to show multiple pop-ups? // Obtain the modal element var modal = document.getElementById("myModal") ...

Ways to implement JavaScript and CSS to set a specific zoom level for a webpage

Looking for a solution using html/css/javascript to standardize the zoom level on a website page. Any suggestions on how to implement this with javascript? ...

Unable to enclose a table within a div element for Chrome web browser

I attempted to keep a table within a div to ensure that the table's width does not go beyond the width of the containing DIV. This table consists of one row with two elements. The second element is fixed in length, while I want the first element to w ...

Use flexbox to arrange labels and input fields in a single line for better display

I've been working on a project where I need to lay out labels and input fields on separate lines using flexbox. <form class="form"> <label> Credit Card Number </label> <input type="searc ...

Enhancing websites with font-awesome icons and upgrading from older versions to the latest

Seeking guidance on updating our project to use the latest Macadmine theme. The transition from Font Awesome 3 to Font Awesome 4 requires changing all icons to their proper names. I came across a helpful resource at https://github.com/FortAwesome/Font-Aw ...

Spinning an SVG path with CSS3 in a circular motion from its central axis

I have a collection of SVG paths, and one of them is displayed below: <path id="GOL" class="st0" d="M37.5,430.5l-12.4-12.4v-13.3h-4.2c-7.2,0-13.9,2.5-18.7,7.5c-4.7,4.9-7.3,11.3-7.3,18.3 c0,7,2.6,13.5,7.3,18.3c4.8,5,11.4,7.6,18.6,7.6l4.2,0v-13.7L36. ...

Ensuring a consistent height for a Angular JS Auto Complete feature

The ng2-auto-complete results appear to be lengthy. When I try to inspect and apply some CSS, the results disappear upon clicking. To address this issue, I experimented with the following code: ng2-auto-complete{ height: 400px; overflow-y: scroll ...

Guide to displaying list-group elements in container 2 after being selected from container 1 in Bootstrap 4

Using bootstrap 4, I have two list-groups in separate containers placed side by side. My goal is to display items in the second container when a list item from the first container is selected. How can I achieve this? The number of rows in the right contai ...

css problem with unique behavior specifically on mobile devices

Check out this link for my code While my layout works perfectly in most browsers, it faces some issues specifically on the Chromium browser and Android default browser. Here's what I'm trying to achieve: The header should remain fixed at the ...

PHP code to create a bottom border in echo statement

Is it feasible to create a bottom border using echo? I'm inquiring about this because I haven't been able to find a direct answer from a reliable source. Essentially, what I want to accomplish is creating a notification similar to those on Faceb ...

Tips for aligning carousel indicators in Bootstrap 4

My objective is to reposition the indicators below the slider image by setting the .carousel-indicators with a bottom: -50px; property. However, when I implement this, the indicators simply disappear. I suspect that this issue is related to the overflow:hi ...

Adjust the parent's height to match the child element using relative and absolute positioning

I am struggling with a seemingly basic issue and can't seem to figure it out. Basically, I have a parent element with a relative position, and a child element with an absolute position. How can I make the parent element expand to match the height of ...

Scrolling to zoom in on the div content

I need the ability to resize the content within a div without changing the size of the div itself when the user scrolls. The function I currently have is as follows: var zoomable = document.getElementById('zoomable'), zX = 1; window.addEvent ...

Adjusting the transparency levels of all div backgrounds simultaneously

Is there a way to uniformly add an alpha value to all the divs on my web page without specifying the exact color code in 'rgba'? I have divs with different background colors and I want to easily revert the changes if needed. Perhaps something al ...

Is there a way to modify the standard width of semantic-ui sidebars?

I'm trying to adjust the width of semantic-ui sidebars, which are originally 275px wide. Where should I include the css/js code to make them wider or narrower? Here is their default code: .ui.sidebar { width: 275px!important; margin-left: -275 ...

Embrace the D3js Force Layout barrier and dive right in

Currently, I am working on a force layout project. My main objective is to enable the nodes to avoid a particular div element placed in the center without utilizing gravity within the SVG. I have already implemented collision detection and bounding within ...

Issue with CSS flipping of DIV in ASP.Net form

I am trying to implement a CSS flip effect that activates on a button click. However, when I place it within an asp.net form, the flip doesn't work. I suspect that the asp.net form may be auto-refreshing and causing issues. Any assistance would be gre ...

Popup modal is obstructed by carousel indicator

I'm having trouble with the following issue: The 3 dots represent my carousel indicator. My problem is that the carousel indicator is blocking my pop-up modal image. I've tried adjusting the z-index of the modal without success. Here is the code ...

Apply a specific class only when the user scrolls within the range of 200px to 300px

Is it possible to dynamically add a class to a div element based on the user's scrolling behavior? For example, I would like to add a class when the user scrolls 200px down the page, and then remove it when they scroll 300px down. Similarly, I want to ...