我正在尝试重新创建 apple.com 可拉伸的焦点搜索框。我已经让它工作了,但我的拉伸背景图像作为他们的接缝优雅地添加到它没有放大镜拉伸。他们还设法将一种背景淡化为另一种背景。
这是我的 CSS
#header input {
background:url(http://www.golfbrowser.com/images/icons/search.png) no-repeat top right;
padding:2px;
margin-top:8px;
margin-right:10px;
padding-left:18px;
font-family:"Lucida Grande", Arial, sans-serif;
font-size:12px;
color:#222;
border:0px;
background-color:none;
float:right;
width:140px;
background-size:160px 20px;
}
#header input:focus {
background:url(http://www.golfbrowser.com/images/icons/search-z.png) no-repeat top right;
transition: width 0.5s, background-size 0.5s, background 0.5s;
-moz-transition: width 0.5s, background-size 0.5s, background 0.5s;
-webkit-transition: width 0.5s, background-size 0.5s, background 0.5s;
-o-transition: width 0.5s, background-size 0.5s, background 0.5s;
width:180px;
background-size:200px 20px;
}
#header input:blur {
transition: width 2s;
-moz-transition: width 2s; /* Firefox 4 */
-webkit-transition: width 2s; /* Safari and Chrome */
-o-transition: width 2s;
width:140px;
background-size:160px 20px;
}