Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
a Summer night - @128.08
Activity rating: Four Stars Posts & Arts: 55/1k.beats Random | Recent Posts | Guild Recents
News: There's a great big indie web tomorrow! :smile: Guild Events: There are no events!

+  MelonLand Forum
|-+  Life & The Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  customizing scroll bars?


« previous next »
Pages: [1] Print Embed
Author Topic: customizing scroll bars?  (Read 3769 times)
morrysillusion
Jr. Member ⚓︎
**
View Profile WWW


⛺︎ My Room

Artifacts:
First 1000 Members!Joined 2022!
« on: a Summer night » Embed

ive been a bit slow on my website coding lately but, as ive been planning a new shrine page i realized i really wanted to make all elements immersive, and one thing ive failed to figure out it... custom scroll bar. if this something that can be changed just with html/css? or do i need to do a bit more?

ive had a weirdly hard time finding concrete answers about this that can keep my code as simple as possible, tbh. so im not entirely sure how it works to change that. any links or explanations appreciated! again id like to keep things simple but, dont mind having to use a bit of javascript if thats where this goes.

when i customaizing, i mean: changing the color mainly. but being able to change the shape, width, etc too.

Logged

https://morrysillusion.net/assets/MI_creaturestamp.png
Melooon
Hero Member ⚓︎
*****
View Profile WWWArt


So many stars!
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: melon
iMood: Melonking
Itch.io: My Games
RSS: RSS

Guild Memberships:
Artifacts:
Bug!You're a Star!Flinstone VitaminI got robbed by Dan Q on Melonland!Always working hard!Known Apple shill
« Reply #1 on: a Summer night » Embed

Ok so I only recently figured this out by snooping cinnis code and mixing it with old code from my site :ohdear:

You need to do it differently for Firefox and Chrome/Safari! Here is the code from my site:

Code
/* Scrollbar styles */
/* Firefox */
* {
  scrollbar-color: #cd7c00 #000020;
}

/* Chrome + Safari */
::-webkit-scrollbar {
  background: #000020;
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #000020;
}

::-webkit-scrollbar-thumb {
  background: #cd7c00;
  border-radius: 10px;
}

On the Firefox version the first colour is the bit you drag and the second colour is the background; note the * will make it chnage EVERYTHING that can scroll, if you only want to change the body scroll or scrolls within iframes you can change * to "body" or "iframe" etc
The Chrome/Safari version has WAY more options, you can do some really intense customisation on it, but at its simplest, the first 2 affect the background and the thumb is the bit you drag!

Documentation for Firefox version: https://css-tricks.com/almanac/properties/s/scrollbar-color/
Documentation for Chrome version: https://developer.mozilla.org/en-US/docs/Web/CSS/::-webkit-scrollbar (Im aware the irony that this is the Mozilla documentation :omg:k:smile:

I know this is a bit clunky and MAYBE there is a better way to do it, but Iv not found one, if anyone knows better please correct me!

Logged


everything lost will be recovered, when you drift into the arms of the undiscovered

Artifact Swap: Red TulipLurbyhere comes the bapSmile on, rainbow flower!Plank
morrysillusion
Jr. Member ⚓︎
**
View Profile WWW


⛺︎ My Room

Artifacts:
First 1000 Members!Joined 2022!
« Reply #2 on: a Summer night » Embed

thank you very much! i seemed to hear there was a difference for browsers too but some pages just said firefox flat out didnt work at all-- i will def take a look at this and try it out!

Logged

https://morrysillusion.net/assets/MI_creaturestamp.png
IndigoGolem
Sr. Member ⚓︎
****
View Profile WWW


What's personal text?
⛺︎ My Room
RSS: RSS

Guild Memberships:
Artifacts:
Visited on Melon's 10th Anniversary!I got robbed by Dan Q on Melonland!Joined 2025!
« Reply #3 on: an Autumn night » Embed

That's pretty cool. My everyday browser supports this and i never noticed until now that the scroll bar is purple here.

It doesn't work in Dillo or NetSurf with their different rendering engines and limited CSS support, nor in CSS-less browsers like Alhena and Links2. It's great in Vivaldi and LibreWolf though.

Logged

-Indigo, Anve Ozo

Artifact Swap: CreampuffNoidIconMichael's HatWildflowers!Hyperactive DonutLove surfing
tanuki
Jr. Member ⚓︎
**
View Profile WWWArt


Surfing the Web
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: tanuki
iMood: tanuki
XMPP: Chat!
RSS: RSS

Guild Memberships:
Artifacts:
Great Posts PacmanCubone, I Choose You!Joined 2024!
« Reply #4 on: an Autumn day » Embed

Code
/* Scrollbar styles */
/* Firefox */
* {
  scrollbar-color: #cd7c00 #000020;
}

/* Chrome + Safari */
::-webkit-scrollbar {
  background: #000020;
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #000020;
}

::-webkit-scrollbar-thumb {
  background: #cd7c00;
  border-radius: 10px;
}

I've totally stolen this for my own site (gave you kudos & linked to this post)  :evil:

This is such an easy way to make your site stand out from others, and add to your sites aesthetic, or at least prevent the boring, default grey scrollbars from ruining the immersion of your readers (This would be great to add if you had a web-comic).

Does anyone know a reason why this isn't done by many other "large" sites? Is it due to accessibility?

Logged
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi
@000 MelonLand Editor Recent Edits Tenement Arcade Want to Login or Join ? Forum Art Hub Chat Webring Web Guides Graphics Catalogue Wiki Newsletters Image Stream
Melon's Sites TamaNotchi Textures PixelSea GifyPet MoMG Ozwomp Online Loom Videos Leaky Webring Melonking
Tools Melon Software ArtHub Embed Maker ML Passports
Outlinks Frutiger Aero Forum Onio Club m15o's Web Services 32Bit Cafe iMood Webrings Internet Phone Book HTML Energy Declarations Hackers & Designers
Zap!
Minecraft: Online
Join: craft.melonking.net