0

I am trying to add a close button on each of input element by using psudo class after. but not working. same works with button element.

here i my code :

.textBox {
    padding: 15px ;
    text-decoration: none;
    display: inline-block;
    position: relative;
}

.textBox:after {
    content: "";
    width: 15px;
    height: 15px;
    background: #ff0 url("http://www.gentleface.com/i/free_toolbar_icons_16x16_black.png") no-repeat -30px -75px;
    border:1px solid red;
    display: inline-block;
    border:1px solid red;
}
<input type="text" class="textBox" value="mytext" name="" id="">

<button class="textBox">Click me</button>
user2024080
  • 1
  • 14
  • 56
  • 96

1 Answers1

1

Use wrap div and set there textBox class instead of in input

.textBox {
    padding: 15px ;
    text-decoration: none;
    display: inline-block;
    position: relative;
}

.textBox:after {
    content: "";
    width: 15px;
    height: 15px;
    background: #ff0 url("http://www.gentleface.com/i/free_toolbar_icons_16x16_black.png") no-repeat -30px -75px;
    border:1px solid red;
    display: inline-block;
    border:1px solid red;
}
<div class="textBox">
<input type="text"  value="mytext" name="" id="">
</div>
<button class="textBox">Click me</button>
לבני מלכה
  • 15,925
  • 2
  • 23
  • 47