Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Need some help with scrollbar color.

  1. #1
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question Need some help with scrollbar color.

    Hi.

    I'm trying to change the color of the scrollbars using CSS.
    The body CSS lokks like this but I can't get it to work.
    Am I missing something?
    It wont work in FF or IE.

    Thanks in advance.
    Cheng

    Here the CCS that specifies the scrollbar color that isn't working:
    Code:
    body {
    	scrollbar-face-color: #000000;
    	scrollbar-highlight-color: #FFFF00;
    	scrollbar-3dlight-color: #FFFF00;
    	scrollbar-darkshadow-color: #FFFF00;
    	scrollbar-shadow-color: #FFFF00;
    	scrollbar-arrow-color: #FFFF00;
    	scrollbar-track-color: #000000;
    	color: #FFFF00;
    	background-color: #000000;
    	font-family: Verdana, Arial, Helvetica, sans-serif;
    	font-size: 16px
    }
    Cheng

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Scrollbar coloring only works in IE fyi. You may need to add the "html" element to your CSS as well:

    Code:
    html, body{
    "
    "
    }

  3. #3
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    .......alright.
    I think that will work.
    After I applied this CSS I let you know.

    Thank you very mch.
    Cheng

  4. #4
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    .......thanks!
    It's working fine now.
    But when make the CSS validation it shows this error message (see attachment).
    Can this be fixed so it will be valid CSS?

    Thanks again.
    Last edited by Cheng; 12-10-2006 at 08:49 AM.
    Cheng

  5. #5
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there Cheng,

    as scrollbar coloring is an IE proprietary, it's use will always cause invalid CSS.

    coothead

  6. #6
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there Cheng,
    Can this be fixed so it will be valid CSS?
    Well, if you really have your heart set on valid CSS you could, of course, apply the scrollbar coloring for IE with javascript...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    body{
        color:#ff0;
        background-color:#000;
        font-family:verdana,arial,helvetica,sans-serif;
        font-size:16px
    }
    div{
        width:300px;
        text-align:justify;
        margin:auto;
     }
    </style>
    
    <!--[if IE]>
    <script type="text/javascript">
    window.onload=function(){
    
       hObj=document.getElementsByTagName('html')[0].style;
    
       hObj.scrollbarFaceColor='#000'
       hObj.scrollbarHighlightColor='#ff0';
       hObj.scrollbar3dlightColor='#ff0'
       hObj.scrollbarDarkshadowColor='#ff0';
       hObj.scrollbarShadowColor='#ff0'
       hObj.scrollbarArrowColor='#ff0';
       hObj.scrollbarTrackColor='#000'
     }
    </script>
    <![endif]-->
    
    </head>
    <body>
    
    <div>
    <p>
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Proin massa. Nam vehicula. 
    Morbi velit nisi, mollis id, ultrices luctus, adipiscing sit amet, lectus. Nunc rhoncus 
    nisl ac enim. Maecenas vestibulum dolor ut velit. Maecenas condimentum pulvinar purus. 
    Pellentesque ac ipsum. Curabitur sodales, elit vel molestie hendrerit, elit odio rhoncus tellus, 
    nec gravida enim urna id velit. Donec nec tellus. Vestibulum nulla. Curabitur enim arcu, 
    ornare id, placerat eget, nonummy vitae, mauris. Nulla rutrum semper odio. Duis vulputate 
    ornare mauris. Praesent eget nibh sed ante ultricies scelerisque. Duis eget felis ut arcu porta 
    bibendum. Mauris rutrum. Vivamus consectetuer purus sit amet mi. Suspendisse eu augue.
    </p><p>
    Quisque nec enim. Nullam elementum. Quisque rhoncus. Ut cursus, pede sit amet facilisis pretium, 
    est erat congue tortor, eget tincidunt metus augue in mauris. Sed id pede. Nam varius faucibus massa. 
    In orci. Suspendisse metus nunc, egestas non, porta a, fermentum interdum, mi. Nulla vel tellus nec 
    erat consectetuer molestie. Vivamus turpis erat, rhoncus sed, ornare vel, volutpat sagittis, nibh.
    </p><p>
    Nulla libero. Aliquam erat volutpat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cum sociis 
    natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut id mauris eget felis laoreet 
    semper. Maecenas venenatis erat et orci. Aenean interdum ligula sed nisi. Nulla vel lectus eu dolor porttitor 
    tempus. Proin at nisi fringilla pede feugiat luctus. Aenean id risus. Vestibulum a erat ac ipsum fringilla 
    feugiat. Cras mauris.
    </p>
    
    </div>
    
    </body>
    </html>
    
    coothead

  7. #7
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Hi coothead.

    Thanks a lot I realy appreciate it.
    This is working but I want to call the script from an external javascript file and I can't manage to do this.
    Could you help me out here by showing me how this works.

    Thanks again very much.
    Cheng

  8. #8
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there Cheng,

    try it like this...

    page...
    Code:
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <!--[if IE]>
    <script type="text/javascript" src="scrollbar.js"></script>
    <![endif]-->
    
    </head>
    <body>
    
    <div></div>
    
    </body>
    </html>
    
    scrollbar.js...
    Code:
    window.onload=function(){
    
       hObj=document.getElementsByTagName('html')[0].style;
    
       hObj.scrollbarFaceColor='#000'
       hObj.scrollbarHighlightColor='#ff0';
       hObj.scrollbar3dlightColor='#ff0'
       hObj.scrollbarDarkshadowColor='#ff0';
       hObj.scrollbarShadowColor='#ff0'
       hObj.scrollbarArrowColor='#ff0';
       hObj.scrollbarTrackColor='#000'
     }
    coothead

  9. #9
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Hi coolthead.

    Got it already.
    I added the scrollbar javascript to the one javascript file I had already and it wasn't working but now I placed the Link to call the script as the last one underneath the starfield background which shouldn't make any difference but it did.
    Now I got everything working like I wanted to with valid XHTML and valid CSS.
    You can have a look here if you care.
    The only thing I still want to change now is that the popup windows here (click the images center bottom) will be windows without a frame like tooltips but I couldn't manage yet.
    Maybe you got an idea how to do this.

    Thanks again very much.
    Cheng

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    There's really no point in doing this. Having a truly valid page is what counts, not simply having the validator say it's a valid page; if you're using Javascript to modify the page to make it invalid, it's not a valid page, no matter what the validator might say
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •