How to use the “required” attribute with a “radio” input field

前端 未结 4 1869
情深已故
情深已故 2020-11-22 12:57

I am just wondering how to use the new HTML5 input attribute \"required\" in the right way on radio buttons. Does every radio button field need the attribute like below or i

4条回答
  •  盖世英雄少女心
    2020-11-22 13:43

    You can use this code snippet ...

    
      
         

    Specify "required" keyword in one of the select statements. If you want to change the default way of its appearance. You can follow these steps. This is just for extra info if you have any intention to modify the default behavior.

    Add the following into you .css file.

    /* style all elements with a required attribute */
    :required {
      background: red;
    }
    

    For more information you can refer following URL.

    https://css-tricks.com/almanac/selectors/r/required/

提交回复
热议问题