我为我的图形创建了这个非常棒的搜索字段。并使用css sprite来创建效果。
这种方法的问题在于,如果你写文字,而不是取消选择(点击搜索栏外的任何地方),第一个背景再次出现,我讨厌它的外观......
在输入文字时如何使其保持对焦状态的任何想法?
我可能会使用jquery,但应该有更简单的方法吗?
.search input.box {
background: url("img/search-bg.png") no-repeat scroll 0 0 transparent;
color: #FFFFFF;
font-size: 0.9em;
height: 32px;
padding: 0 0 0 31px;
width: 159px;
}
.search input.box:focus {
background: url("img/search-bg.png") no-repeat scroll left -32px transparent;
outline: medium none;
}
答案 0 :(得分:0)
不确定你是否弄明白了。我总是使用jQuery。问题是,一旦输入失去焦点,它将恢复为.search input.box样式。