我想重新創建焦點上的apple.com彈性搜索框。我已經掌握了它的工作原理,但我的背景圖片延伸到了沒有放大鏡拉伸的地方,因爲它們的接縫優雅地增加了它。他們也設法將一個背景淡入另一個背景。模擬Apple.com搜索拉伸與CSS3轉換
這裏是我的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;
}
以及執行看到http://www.golfbrowser.com/