我实际上是CSS的新手,并且不知道如何创建像stackoverflow搜索表单这样的输入,我认为可以通过按钮的jquery触发器来完成,并更改该表单的宽度值?有任何建议或解决方案吗?
答案 0 :(得分:0)
Woman's Fashion
答案 1 :(得分:0)
或使用以下内容,请查看整页。
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
list-style: none;
font-family: helvetica, arial, sans-serif;
font-size: 14px
}
div#bar {
height: 40px;
background: #ccc;
box-shadow: inset 0 40px 40px -20px #eee;
padding-right: 200px;
}
div#bar > div {
position: relative;
padding-top: 5px
}
div#bar input, div#bar ul {
float: right;
}
div#bar input {
height: 30px;
width: 275px;
border-radius: 5px;
border: none;
padding: 5px;
border-top: 1px solid #ccc;
border-bottom: 1px solid #fff;
background: #eee;
color: #333;
transition: all .7s
}
div#bar input:focus {
width: 625px;
background: white;
position: relative;
z-index: 20
}
div#bar input:focus + ul {
position: absolute;
right: 300px;
opacity: 0
}
div#bar ul {
width: 400px;
height: 30px;
position: absolute;
right: 300px;
opacity: 1;
transition: opacity .35s
}
div#bar ul li {
float: right;
line-height: 30px;
margin-left: 20px;
}

<div id="bar">
<div>
<input type="text" placeholder="search" />
<ul>
<li>Questions</li>
<li>Jobs</li>
<li>Documentation</li>
<li>Tags</li>
<li>Users</li>
</ul>
</div>
</div>
&#13;