Remove IE10's “clear field” X button on certain inputs?

前端 未结 6 2329
故里飘歌
故里飘歌 2020-11-22 15:51

It\'s a useful feature, to be sure, but is there any way to disable it?
For instance, if the form is a single text field and already has a \"clear\" button beside it, it

6条回答
  •  误落风尘
    2020-11-22 16:21

    I found it's better to set the width and height to 0px. Otherwise, IE10 ignores the padding defined on the field -- padding-right -- which was intended to keep the text from typing over the 'X' icon that I overlayed on the input field. I'm guessing that IE10 is internally applying the padding-right of the input to the ::--ms-clear pseudo element, and hiding the pseudo element does not restore the padding-right value to the input.

    This worked better for me:

    .someinput::-ms-clear {
      width : 0;
      height: 0;
    }
    

提交回复
热议问题