Solved

Change browser scrollbar color

Posted on 2003-11-20
10
2,269 Views
Last Modified: 2010-04-09
Hello,

How can the browser's scrollbar color change, like on this link:

http://www.woodyswatch.com/access/

0
Comment
Question by:ornicar
  • 3
  • 2
  • 2
  • +2
10 Comments
 
LVL 8

Assisted Solution

by:MusicMan
MusicMan earned 100 total points
ID: 9788385
Try here

http://www.codelifter.com/main/javascript/changescrollbarcolor1.html

They have a neat script to do just what you want.

HTH
MM
0
 
LVL 15

Expert Comment

by:Daydreams
ID: 9788756
You can do it easily with CSS:
(From http://www.websitetips.com/info/css/scrollbars.html)

<html>
<head>

<style type="text/css">
<!--

body {scrollbar-3dlight-color:gold;
scrollbar-arrow-color:yellow;
scrollbar-base-color:tomato;
scrollbar-darkshadow-color:orange;
scrollbar-face-color:teal;
scrollbar-highlight-color:hotpink;
scrollbar-shadow-color:magenta}


-->
</style>

</head>
<body>
<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>. The <p>'s are here just to fill the page so you can see the whole scrollbar since there is no other content to scroll.
</body>
</html>

0
 
LVL 15

Accepted Solution

by:
Daydreams earned 200 total points
ID: 9788821
Or try this fun script, (and hover your mouse over the scrollbar to see the color change):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>scrollbar colors onmouse</title>
</head>
<body onmousemove="move()" link="#00FFFF" vlink="#00FFFF">

<script language="javascript"><!--
function move()
 {
  chk = document.body.clientWidth + 2;
  if(window.event.x > chk) //Ist Mauszeiger über Scrollbar?
   {
    var sfc = "powderblue";     //scrollbar-face-color
    var ssc = "red";     //scrollbar-shadow-color
    var shc = "blue"; //scrollbar-highlight-color
    var stc = "yellow"; //scrollbar-track-color
    var sac = "green"; //scrollbar-arrow-color

    document.body.style.scrollbarFaceColor = sfc;
    document.body.style.scrollbarShadowColor = ssc;
    document.body.style.scrollbarTrackColor = stc;
    document.body.style.scrollbarHighlightColor = shc;
    document.body.style.scrollbarArrowColor = sac;
   }
  else //wenn Mauszeiger nicht über Scrollbar
   {
    var sfc = "orange"; //scrollbar-face-color
    var ssc = "red"; //scrollbar-shadow-color
    var shc = "white"; //scrollbar-highlight-color
    var stc = "lightblue"; //scrollbar-track-color
    var sac = "blue";       //scrollbar-arrow-color

    document.body.style.scrollbarFaceColor = sfc;
    document.body.style.scrollbarShadowColor = ssc;
    document.body.style.scrollbarTrackColor = stc;
    document.body.style.scrollbarHighlightColor = shc;
    document.body.style.scrollbarArrowColor = sac;
   }
 } // -->
</script>
<h1>Hover your mouse over the scrollbar<br>
 and see it change colors</h1>
<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p> <p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.
</body>

</html>
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9789919
Note that this is MSIE/Windows only, and will not work with other browsers (and the JS solutions offered may cause errors in them as well).
0
 
LVL 9

Author Comment

by:ornicar
ID: 9790067
The CSS work only with IE?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 35

Assisted Solution

by:YZlat
YZlat earned 100 total points
ID: 9796620
<style>
body {
 scrollbar-track-color:#FFC7DB;

 scrollbar-face-color:#00E9FF;
 scrollbar-highlight-color:#B5224E;

 scrollbar-3dlight-color:#FF00FF;
 scrollbar-base-color:blue;
 scrollbar-darkshadow-color:black;
 scrollbar-shadow-color:#FFD1F0;
 scrollbar-arrow-color:#DA8DFF;
}

</style>
0
 
LVL 11

Assisted Solution

by:Zontar
Zontar earned 100 total points
ID: 9797017
>  The CSS work only with IE?

Some of it will also work with recent versions of Opera for Windows *if* the user has allowed it in his preferences. The preference is disabled by default. The styles won't work at all in Mozilla, Safari, Konqeror, any version of Netscape, or IE/Mac. Personally I prefer using a browser that doesn't support this -- the purpose of CSS is to allow web authors to set the presentation of their pages, not to let them monkey around with my user interface. It would appear that W3C agrees with this sentiment, which is why none of the scrollbar-related styles are part of the CSS-2 specification. Nor will you find them in the CSS-2.1 or CSS-3 drafts.
0
 
LVL 9

Author Comment

by:ornicar
ID: 9828027
Thanks a lot.
0
 
LVL 15

Expert Comment

by:Daydreams
ID: 9828257
ornicar, you're welcome.. and thanks for the A:)
0
 
LVL 8

Expert Comment

by:MusicMan
ID: 9828660
Glad to have been of assistance :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now