アイコンをテキスト入力フィールドに入れようとしています。
例:
1 つの解決策は、background-imageを使用してから、padding-leftを使用することです。
しかし、CSSスプライトを使いたいです。次のコードを試しました:
<!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>
私は何を間違っていますか?