1

When applying ::before on input it does not. So i did some search and some answer clarified that since it is a replaced element ::before or ::after will not work on them.

Now when i use appearance:none on input the ::before works on checkbox and radio but not on input:text. Can some one tell me what magic does appearance does on the input element.

I tried searching this on internet but could not find something useful

consider below piece of code:

input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  position: relative;
}
input::before {
  content: "X";
  width: 10px;
  height: 10px;
  display: block;
  outline: 4px solid orange;
  position: absolute;
  top: 20px;
  left: 50px;
}
<input type="text" name="" id="">
<input type="checkbox" name="" id="">
tacoshy
  • 10,642
  • 5
  • 17
  • 34
tin_tin
  • 478
  • 3
  • 10
  • 24
  • apperance is doing nothing, it always works on checkbox (at least on chrome) – Temani Afif Mar 26 '21 at 19:25
  • Does this answer your question? [Can I use a :before or :after pseudo-element on an input field?](https://stackoverflow.com/questions/2587669/can-i-use-a-before-or-after-pseudo-element-on-an-input-field) – Sergey Sklyar Mar 26 '21 at 19:38
  • If you want before and after, while it's true that you cannot strictly attach them to an input element, you can use a label. – A Haworth Mar 26 '21 at 22:51

0 Answers0