1

I run a forum on which i'd like to change the scrollbar. I'd like it to look like this:

enter image description here

And I need to know where to put the HTML for this.

I think it goes in overall_header.html (http://prntscr.com/brvnvj) I'm assuming the CSS goes here? (http://prntscr.com/brvo2b)

I'm a complete noob, please help.

1
  • Welcome to Stack Overflow! It is expected that you at least attempt to code this for yourself. Stack Overflow is not a code writing service. I would suggest that you do some additional research, either via Google or by searching SO, make an attempt and. if you still have trouble, come back with your code and explain what you have tried and why it did not work. Commented Jul 12, 2016 at 10:01

3 Answers 3

1

You cannot style the existing browser UI elements using CSS. (Thankfully! Did you remember those rainbow colored scrollbars and the end of the 90ies?)

But you may use some JS-plugin to create your own scrollbars. But make sure the user can still use “normal” scrolling. This means, not only must the scrollbar be draggable, but the content should also scroll when using the mousewheel, the up- and down-arrows or the page-up- or page-down-keys. Space bar should jump to the end of the page and so on. In fact you have to provide everything the browser has already implemented.

There are a lot of existing JS-plugins for such a task on the web already.

Sign up to request clarification or add additional context in comments.

2 Comments

Well you CAN style scrollbars...just not crossbrowser - stackoverflow.com/questions/9251354/…
I was born in 2000 lmfao
0

Add this Style in Head Section:

You can change Colour in rgba(0,0,0,0.3) by changeing Value.

<style type="text/css">
     ::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
}
   </style>

Comments

0

This should help you achieve what you want:

//the color of the scrollbar
body::-webkit-scrollbar {
  background-color: darkgrey;
}


//the color of the thumb of the scrollbar
body::-webkit-scrollbar-thumb {
  background-color: blue;
}

Note that this css trick is not cross browser compatible. Also about the question where to add the code. You can either put it in an external file and load it in the header or just add the code somewhere in your body tag via code...

1 Comment

I combined both of your replies and they worked, thanks :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.