AlfieWebDevTips Homefor new and experienced developers
[Home Home] [Web Development Web Development ] [Code Generators Code Generators ] [Resources Resources ] [Contact Us Contact ] |WebDevTips Privacy Privacy |
Print This Page

You are here : Home - Web Development - Style Sheets - Scrollbar Validation

Scrollbars that validate



Do you like the colored scrollbar feature on Internet Explorer?

Did you know know that if you use this feature you won't be able to validate your style sheets?

Well now you can have the best of both worlds - valid CSS and colored scroll bars.

First thing you have to do is remove any scrollbar tags from your style sheet then go here to validate your style sheet.

Once you have validated your style sheet all we need to do to color the scrollbars is add some javascript.

<script language="JavaScript" type="text/javascript">
<!--
function doscrolls(){

if (document.all && document.getElementById){
document.body.style.scrollbarFaceColor="COLOR";
document.body.style.scrollbarArrowColor="COLOR";
document.body.style.scrollbarHighlightColor="COLOR";
document.body.style.scrollbar3dlightColor="COLOR";
document.body.style.scrollbarDarkshadowColor="COLOR";
document.body.style.scrollbarTrackColor="COLOR";
document.body.style.scrollbarShadowColor="COLOR";
}

}
// -->
</script>

Place the above code between the <head></head> tags.

Finally all you have to do is call the function from onload.

<body onload="doscrolls();">

And that's all there is to it. You get valid CSS code and you get colored scrollbars.

Why not use the style code generator to create your code.







Google
 

[back to top of page]   

[labelled with icra -  - this link will open in a new window] [RSS Content]

[Copyright © WebDevTips]