我有一个搜索栏,旁边有一些社交媒体按钮。当我单击它时,我想使用 CSS3 Transition 属性来改变条的宽度,但我也需要按钮来移动。这是我到目前为止所拥有的
#s
{
transition: width 2s;
-moz-transition: width 2s; /* Firefox 4 */
-webkit-transition: width 2s; /* Safari and Chrome */
-o-transition: width 2s; /* Opera */
}
#s:focus {
width:110px;
}
.search input[type="text"], .widget_search input[type="text"] {
background-image: url(api/images/icons/search.png);
background-repeat: no-repeat;
background-position: 8px 50%;
padding-left: 25px;
width: 80%;
-moz-border-radius: 1em;
-webkit-border-radius: 1em;
border-radius: 1em;
}
#searchform #searchsubmit {
clear: both;
display: block;
margin: 10px 0;
}
文本字段的宽度改变得很好,但重申一下,我想知道当我单击文本字段时是否可以更改文本字段旁边的按钮的位置。
<div id="header-widget-area" class="widget-area" role="complementary">
<div id="pc_info_widget_designfolio-4" class="widget pc_info_widget">
<a class="sm-icon" target="_blank" href="http://www.facebook.com/TheRedBalloonToyStore">
<img width="32" height="32" alt="Facebook" src="http://redballoontoystore.com/w/wp-content/themes/designfolio/images/facebook.png">
</a>
<a class="sm-icon" target="_blank" href="http://twitter.com/RBToyStore">
<img width="32" height="32" alt="Twitter" src="http://redballoontoystore.com/w/wp-content/themes/designfolio/images/twitter.png">
</a>
<div class="search">
<form id="searchform" action="http://redballoontoystore.com/w/" method="get" role="search">
<span>
<input id="s" type="text" name="s" size="10" value="" placeholder="Search…">
<input id="searchsubmit" type="submit" value="Search">
</span>
</form>
</div>
</div>
</div>