Styling checkboxes, radio buttons and dropdowns

前端 未结 11 1846
栀梦
栀梦 2020-12-05 10:58

How can I style HTML checkboxes, radio buttons and dropdowns? Or can I?

I\'d like to use an image for checkboxes or radiobuttons, and the same for lists - the dropdo

相关标签:
11条回答
  • 2020-12-05 11:39

    Most likely you won't be able to, it is very difficult. Personally, I would just stay away from that.

    0 讨论(0)
  • 2020-12-05 11:41

    I believe CSS 3 will allow you to style those elements, but for now it isn't directly possible.

    See this question: CSS checkbox input styling

    0 讨论(0)
  • 2020-12-05 11:41

    You can't put an image as a checkbox, but you can always build your own checkbox :D.

    Put a hidden field and an image, add an "onclick" event over the image. When the onclick is fired check the status of the hidden field, change the image according to the status and save the status of the checkbox in your hidden field.

    You should check for custom javascript libraries. One of my favorities is http://www.dojotoolkit.org/

    0 讨论(0)
  • 2020-12-05 11:42

    This guy pretty much has all the styling you can put on form controls, but it's not consistent across browsers. You are going to have to go custom. Use a custom image for the checkbox, then change it's source to get the clicked version (and vice versa). The select menu might be a little trickier. I hope there's a jQuery plugin out there that can help you!

    0 讨论(0)
  • 2020-12-05 11:43

    Recently i come across amazing WTF, forms? from a creator of Bootstrap Mark otto. It has great styles for

    • Checkbox
    • Radio button
    • Select
    • Progress bar
    • File Browser

    Checkout http://wtfforms.com/

    0 讨论(0)
  • 2020-12-05 11:46

    You can style form elements, but it is difficult (impossible?) to get a consistent style across browsers and operating systems with a pure CSS approach. Some script manipulation of styles would also be required.

    This is a very good article that discusses the options and issues: Styling form controls

    Listamatic has a great collection of CSS list styles.

    0 讨论(0)
提交回复
热议问题