HTML怎么定义搜索栏

发布时间:2021-03-03 15:12:35 作者:小新
来源:亿速云 阅读:263

小编给大家分享一下HTML怎么定义搜索栏,希望大家阅读完这篇文章之后都有所收获,下面让我们一起去探讨吧!

HTML定义搜索栏的方法:首先新建一个div,id名为box;然后在内部添加一个input标签和一个div标签;最后使用css为它们设计样式即可。

HTML定义搜索栏的方法:

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

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

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

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

看完了这篇文章,相信你对“HTML怎么定义搜索栏”有了一定的了解,如果想了解更多相关知识,欢迎关注亿速云行业资讯频道,感谢各位的阅读!

推荐阅读:
  1. html5中怎样制作搜索栏
  2. avue如何实现自定义搜索栏及清空搜索事件

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

html

上一篇:怎么样购买域名和服务器

下一篇:html中设置form大小的方法

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》