Home > Web Front-end > HTML Tutorial > How to define search bar in HTML

How to define search bar in HTML

coldplay.xixi
Release: 2023-01-03 09:27:20
Original
4086 people have browsed it

How to define the search bar in HTML: first create a new div with the id name box; then add an input tag and a div tag inside; and finally use css to style them.

How to define search bar in HTML

The operating environment of this tutorial: windows7 system, html5 version, DELL G3 computer.

How to define the search bar in HTML:

1. First create a new div with the id name box to wrap the search box;

2 , and then add an input tag and a div tag inside, one for text input and one as a button;

3. Finally, use css to style them.

<!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: &#39;Microsoft YaHei&#39;;
        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>
Copy after login

Related learning recommendations: html video tutorial

The above is the detailed content of How to define search bar in HTML. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template