is there a way to position absolute a scrollbar?

screenshot for a reference, i've added a overflow to scroll to the main panel of dashboard i dont want the side bar to scroll. but i want the scroll bar to be at the right corner of the screen position absolute isn't working. is there a work around
No description
13 Replies
Jochem
Jochem3mo ago
you've probably got a margin on the right side of the main content div. Change it to a padding, that'll push the scrollbar to the right the scrollbar will always be on the extreme right of the element that's scrolling, so your only solution is to make the element end where you want the scrollbar to be (or to roll your own which is a lot of hard work and an accessibility nightmare you should never attempt)
Israr
Israr3mo ago
what i am doing right now is i'vewraped the wholething into 1 div to maintain the max width is there a way to maintain a maxed with while using padding for this
Jochem
Jochem3mo ago
a wrapper div. have that one be the scrolling one and the content div inside be the one with the margin or padding (doesn't really matter then anymore)
clevermissfox
clevermissfox3mo ago
box-sizing : border-box
Israr
Israr3mo ago
can you please elaborate?
Israr
Israr3mo ago
what i did now is wrapped the whole thing into a container annd outer div is full width
No description
Israr
Israr3mo ago
now the scrollbar is at the corer but the side bar is also scrolling how do i make it stick there? sticky isnt wornking
Jochem
Jochem3mo ago
you'll have to share your code at this point, preferably in something like codepen or another live version
Israr
Israr3mo ago
made it work
No description
Israr
Israr3mo ago
😮‍💨 finally
Skriti mož
Skriti mož3mo ago
what was the thing?
Israr
Israr3mo ago
scrollbar
clevermissfox
clevermissfox3mo ago
Box-sizing: border box takes the border and padding to count within any sizing defined instead of adding it on as extra. You’ll see in many resets that it’s defined on the *, *::before, *::after selector So if you have a width of 200px, your 10px border and padding of 2em is included in that 200px