标题 | Bootstrap实现弹性搜索框 |
内容 | Bootstrap是Twitter推出的一个用于前端开发的开源工具包。它由Twitter的设计师Mark Otto和Jacob Thornton合作开发,是一个CSS/HTML框架。 接下来通过本文给大家介绍Bootstrap实现弹性搜索框的代码,一起看下吧。 <form action="" method="get"> <div> <input type="hidden" name="scope" value="1"> <input name="key" autocomplete="off" type="text" placeholder="输入要搜索的内容关键字" > <span> <button type="submit"> <span></span> </button> </span> </div> </form> 对应的CSS: .search-input-group .input-group-addon{ background: white !important; } .search-input-group .form-control{ border-right:0; box-shadow:0 0 0; border-color:#ccc; } .search-input-group{ width: 40%; } .search-input-group button{ border:0; background:transparent; } .search-input-group input:focus + button{ z-index:3; } .search-input-group input{ -webkit-transition: width 0.2s ease-in-out; -moz-transition:width 0.2s ease-in-out; -o-transition: width 0.2s ease-in-out; transition: width 0.2s ease-in-out; } .search-input-group input:focus{ width: 500px; } 若想把搜索图标放到输入框的前面,bootstrap其实是不支持的,需要自己定制一下。 以上所述是小编给大家介绍的Bootstrap实现弹性搜索框的全部叙述,希望对大家有所帮助 |
随便看 |
|
在线学习网考试资料包含高考、自考、专升本考试、人事考试、公务员考试、大学生村官考试、特岗教师招聘考试、事业单位招聘考试、企业人才招聘、银行招聘、教师招聘、农村信用社招聘、各类资格证书考试等各类考试资料。