Use CSS to automatically add 'required field' asterisk to form inputs

前端 未结 16 2795
有刺的猬
有刺的猬 2020-11-28 19:10

What is a good way to overcome the unfortunate fact that this code will not work as desired:

16条回答
  •  心在旅途
    2020-11-28 19:46

    .required label {
        font-weight: bold;
    }
    .required label:after {
        color: #e32;
        content: ' *';
        display:inline;
    }
    

    Fiddle with your exact structure: http://jsfiddle.net/bQ859/

提交回复
热议问题