Is it possible to make standard controls like buttons and scrollbars look different? For instance, I have my own images for normal and pressed button states, how to make a button use them?
If I just set backgrounds for bot开发者_运维问答h normal and pressed styles, the button still has its initial form, that doesn't match my image form.
Then, what about scrollbars? They are complex, and contain more than one image for every state.
Regards,
For form controls; make use of the :active
and :hover
pseudo-classes in CSS, and replace the background of your buttons and form elements with images. In this excellent tutorial, you're guided through creating a custom search form using HTML5 and CSS3 with these techniques.
For scrollbars, either avoid changing their style altogether (especially if you're talking about the viewport scrollbars, as these are part of the browser, not your website, and users expect them to look a certain way. If you absolutely have to change them, simply use progressively enhancing javascript (perhaps using jQuery) to first hide the scrollbars (setting overflow: hidden
), then inserting button
and input type="range"
(or non-HTML5 elements if browser support is important) into the DOM, styling them the way you want and hooking their click
events to scroll whatever needs scrolling. There are many jQuery plugins that do this for you.
Often you have to layer divs over these controls or create controls from scratch. Looking at how JQuery UI displays certain controls is a good place to start understanding how it can be done. The easy way is to just use JQuery UI and use themeroller or customized css to style the controls. It's not easy to accomplish some of these tasks on your own.
http://jqueryui.com/
精彩评论