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

前端 未结 16 2759
有刺的猬
有刺的猬 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:49

    To put it exactly INTO input as it is shown on the following image:

    enter image description here

    I found the following approach:

    .asterisk_input::after {
    content:" *"; 
    color: #e32;
    position: absolute; 
    margin: 0px 0px 0px -20px; 
    font-size: xx-large; 
    padding: 0 5px 0 0; }
    
     

    Site on which I work is coded using fixed layout so it was ok for me.

    I'm not sure that that it's good for liquid design.

提交回复
热议问题