html搜索框怎么做
使用HTML做搜索框的方法:
1、首先新建一個div,id名為box,用來包裹搜索框;
2、然后在內部添加一個input標簽和一個div標簽,一個用來輸入文字,一個充當按鈕;
3、最后使用css為它們設計樣式即可。
推薦學習:html教程
<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><title>Examples</title><meta name="description" content=""><meta name="keywords" content=""><link href="" rel="stylesheet"><style type="text/css"> #box{ width: 380px; margin: 30px auto; font-family: 'Microsoft YaHei'; font-size: 14px; } input{ width: 260px; border: 1px solid #e2e2e2; height: 30px; float: left; background-image: url(images/search.jpg); background-repeat: no-repeat; background-size: 25px; background-position:5px center; padding:0 0 0 40px; } #search{ width: 78px; height: 32px; float: right; background: black; color: white; text-align: center; line-height: 32px; cursor: pointer; } </style></head><body> <div id="box"> <input type="search" name="search" placeholder="請輸入關鍵字"> <div id="search">搜索</div> </div></body></html>
效果:
更多相關教程,請關注PHP中文網!
以上就是html搜索框怎么做的詳細內容,更多請關注武林網其它相關文章!
鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。
新聞熱點
疑難解答