Bootstrap實現(xiàn)彈性搜索框
來源:易賢網 閱讀:1371 次 日期:2016-07-28 16:06:27
溫馨提示:易賢網小編為您整理了“Bootstrap實現(xiàn)彈性搜索框”,方便廣大網友查閱!

Bootstrap是Twitter推出的一個用于前端開發(fā)的開源工具包。它由Twitter的設計師Mark Otto和Jacob Thornton合作開發(fā),是一個CSS/HTML框架。

接下來通過本文給大家介紹Bootstrap實現(xiàn)彈性搜索框的代碼,一起看下吧。

<form action="" method="get" class="form-horizontal">

<div class="input-group search-input-group">

<input type="hidden" name="scope" value="1">

<input name="key" autocomplete="off" type="text" class="form-control" placeholder="輸入要搜索的內容關鍵字" >

<span class="input-group-addon">

<button type="submit">

<span class="glyphicon glyphicon-search"></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實現(xiàn)彈性搜索框的全部敘述,希望對大家有所幫助

更多信息請查看網絡編程
易賢網手機網站地址:Bootstrap實現(xiàn)彈性搜索框

2025國考·省考課程試聽報名

  • 報班類型
  • 姓名
  • 手機號
  • 驗證碼
關于我們 | 聯(lián)系我們 | 人才招聘 | 網站聲明 | 網站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機站點 | 投訴建議
工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網安備53010202001879號 人力資源服務許可證:(云)人服證字(2023)第0102001523號
聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關注公眾號:hfpxwx
咨詢QQ:1093837350(9:00—18:00)版權所有:易賢網