I had situation like this. It didn't work because of background: #ebebeb;. I wanted to put background on the input field and that property was constantly showing up on the top of the background image, and i couldn't see the image! So, I moved the background property to be above the background-image property and it worked.
The site you linked uses a combination of CSS tricks to pull this off. First, it uses a background-image for the <input> element. Then, in order to push the cursor over, it uses padding-left.
Using with font-icon
OR
I had situation like this. It didn't work because of
background: #ebebeb;
. I wanted to put background on the input field and that property was constantly showing up on the top of the background image, and i couldn't see the image! So, I moved thebackground
property to be above thebackground-image
property and it worked.Solution for my case was:
Just to mention,
border
,padding
andtext-align
properties are not important for the solution. I just replicated my original code.The site you linked uses a combination of CSS tricks to pull this off. First, it uses a background-image for the
<input>
element. Then, in order to push the cursor over, it usespadding-left
.In other words, they have these two CSS rules:
You Can Try this : Bootstrap-4 Beta
https://www.codeply.com/go/W25zyByhec
This works for me:
The CSS solutions posted by others are the best way to accomplish this.
If that should give you any problems (read IE6), you can also use a borderless input inside of a div.
Not as "clean", but should work on older browsers.