本文摘自PHP中文网,作者coldplay.xixi,侵删。
HTML定义搜索栏的方法:首先新建一个div,id名为box;然后在内部添加一个input标签和一个div标签;最后使用css为它们设计样式即可。
![](http://ypimg.muzhuangnet.com/Collect/csharp/upload/article/202103/03/2021030314391677872.jpg)
本教程操作环境:windows7系统、html5版,DELL G3电脑。
HTML定义搜索栏的方法:
1、首先新建一个div,id名为box,用来包裹搜索框;
2、然后在内部添加一个input标签和一个div标签,一个用来输入文字,一个充当按钮;
3、最后使用css为它们设计样式即可。
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>
|
相关学习推荐:html视频教程
以上就是HTML如何定义搜索栏的详细内容,更多文章请关注木庄网络博客!
相关阅读 >>
Html与xHtml的区别详解
关于Html主体的一些问题探讨
Html如何写出竖线
Html怎样实现页面跳转时传递参数
table标签的cellspacing属性有什么用?一篇文章让你了解cellspacing属性
纯css+div隐藏滚动条的实现方法(代码示例)
Html是网页文件吗
Html表单元素
Html怎么设置左边距
Html中select的option怎样设置默认选择
更多相关阅读请进入《Html》频道 >>
人民邮电出版社
本书对 Vue.js 3 技术细节的分析非常可靠,对于需要深入理解 Vue.js 3 的用户会有很大的帮助。——尤雨溪,Vue.js作者
转载请注明出处:木庄网络博客 » HTML如何定义搜索栏