문제

Well, I curious as to the nature of Radio groups and dropdown lists in HTML. I have found that radio buttons are difficult to style but I would like to style my elements for required fields. I asked a previous question regarding styling radio buttons and giving a border color like you can do with text boxes, example:

<input type="text" style="border-color:#FF0000">
<input type="radio" style="border-color:#FF0000">

applying style to a radio button to change the border color does not work.

My Question is there any reason why I shouldnt use a drop down list insead of a radio group?

도움이 되었습니까?

해결책

Drop down lists require more work (on the part of the user) to find out what options are available … and are as twiddly to style as radio buttons anyway.

You might try setting the border colour on the fieldset containing the radio group instead. Remember to also use some other method for indicating required fields though.

다른 팁

A radio group will take more room on your form than a drop down list, and of course the controls look different in appearance. My rule of thumb is if there are more than three or four choices, use a drop down list.

Majority of the users (includes mostly people with no computer background and elderly people) are really very familiar with radio buttons to answer questions of the type yes/no , male/female etc. For the convenience of the users use a radio button for such questions.

With Drop down lists the available options are not visible to the user until they interact (click it). With radio buttons all of the available options are in front of the user. While both allow you to limit the selection choices to just one option, I find that users can decide which option they want quicker with radio buttons. If it is more than 5 options though, I would reconsider.

Related question on ux.stackexchange.

Use a drop-down list for when one choice is regarded as "more important" and the alternatives are okay as being hidden from the user, for example, selecting a state in the U.S. A user lives in one state, and the alternative choices don't matter. When the user comes to the form item, they know exactly what to choose without looking at the alternatives.

On the other hand, use radio buttons for when the choices are all equally important, or the user needs to see all of them before making a selection, for example, rating on a scale from 1 to 5, or choosing an answer choice on a multiple-choice problem.

Another factor to take into account is screen real-estate: you wouldn't want radio buttons for selecting one of 50 states, and you probably wouldn't want a drop-down list for selecting a sex (Male or Female). Depending on your design and philosophy, this factor may or may not trump the factors stated above.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top