I'm attempting to insert an icon into a text input field.
For example:
One approach is to utilize background-image and then apply padding-left.
However, I am interested in using CSS sprites. I have experimented with the following code:
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.input {
padding-left:35px;
width: 128px;
background: Red;
}
.sprite:before{
background: url('http://img45.imageshack.us/img45/4259/buildingssheet7dv.png');
content: " ";
position: absolute;
height:32px;
width:32px;
margin: -10px 0 0 -10px;
z-index:100;
}
.sprite:before {
background-position: -32px 0;
}
</style>
</head>
<body>
<input type="text" class="input sprite"></input>
</body>
</html>
Any idea what could be going wrong?