Solved

Change browser scrollbar color

Posted on 2003-11-20
10
2,274 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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
 
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Centered Image 2 29
HTML &#0153 2 19
Applications / Web Apps that enable highlighting text on Web Pages 3 25
Get Pixel color of the x and y axis Html without canvas 8 36
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…

810 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