Place a non editable percentage sign within a HTML input field

前端 未结 4 1697
慢半拍i
慢半拍i 2021-01-02 18:01

I currently have a series of input field boxes which are numerical based. The trouble I am having is adding a \'%\' symbol at the end of each box. Ultimately i want the % sy

4条回答
  •  温柔的废话
    2021-01-02 18:29

    I would style your spans to look like your inputs and then remove the styles from the input. You can then use the after psuedo selector to add the percentage:

    .input-holder {
      border: 1px solid #cccccc;
      display: inline-block;
      padding: 5px;
    }
    .input-holder > input {
      border: 0;
      margin: 0;
      padding: 0;
      outline:none;
    }
    .input-holder:after {
      content: '%';
    }
    New Value




提交回复
热议问题