百搜论坛欢迎您的加入!
adimg adimg
 
昨日:篇  今日:篇   总帖:篇   会员:
博主最大Lv63   
html搜索框怎么做     

html搜索框怎么做

使用HTML做搜索框的方法:

1、首先新建一个div,id名为box,用来包裹搜索框;

2、然后在内部添加一个input标签和一个div标签,一个用来输入文字,一个充当按钮;

3、最后使用css为它们设计样式即可。

推荐学习:html教程

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

<!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>

效果:

3bf33a87e950352a0b7099235a43fbf2b2118b8c.png

更多相关教程,请关注PHP中文网

以上就是html搜索框怎么做的详细内容

 0  已被阅读了986次  楼主 2020-06-22 12:13:32
回复列表

回复:html搜索框怎么做

联系站长 友链申请桂ICP备19000949号-1     桂ICP备19000949号-1
您的IP:3.133.108.241,2024-04-29 16:11:36,Processed in 0.02294 second(s).
免责声明: 本网不承担任何由内容提供商提供的信息所引起的争议和法律责任。
Powered by HadSky 7.12.9
已有0次打赏
(0) 分享
分享
取消
免责声明
1、本站资源,均来自网络,版权归原作者,所有资源和文章仅限用于学习和研究目的 。
2、不得用于商业或非法用途,否则,一切责任由该用户承担 !
如果觉得本文还不错请点个赞或者打赏点轻币哦~
拒绝伸手党,拿走请回复,尊重楼主,尊重你我他~

侵权删除请致信 E-Mail:207882320@qq.com