首页 > 代码库 > 搜索框制作

搜索框制作

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!--防止IE浏览器进入怪异文档模式,兼容性视图-->
    <!--content="IE=edge",意思为文档模式用最新版本IE文档模式进行渲染。-->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>bing search</title>
    <style type="text/css">
        body {
            background-color: #333;
        }

        .bg-div {
            background-image: url(river.jpg);
            width: 1228px;
            height: 690px;
            /*图片居中*/
            margin: 0 auto;
        }

        .logo {
            background-image: url(logo.png);
            width: 107px;
            height: 53px;
            float: left;
            margin: -6px 18px 0 0;
        }

        form {
            float: left;
            background-color: #fff;
            padding: 5px;

        }

        .search-input-text {
            border: 0;
            float: left;
            height: 25px;
            line-height: 25px;
            outline: none;
            width: 350px;
        }

        .search-input-submit {
            border: 0;
            background-image: url(search-button.png);
            width: 29px;
            height: 29px;
            float: left;
        }

        .search-box {
            position: relative;
            top: 160px;
            left: 300px;
        }
    </style>
</head>
<body>
<!--bg-div 设置背景图片-->
<!--search-box 使form表单绝对定位-->
<!--logo和form均float:left使两者对齐-->
<!--search-input-text与search-input-text均float:left使两者对齐-->
<!--value="" 去除type="submit"的默认提交样式-->
<!--outline:none;去掉输入框输入时的高亮状态-->
<!--border:0;去掉搜索框原有的灰色边框-->
<!--height:25px; line-height:25px   使输入框居中-->
<div class="bg-div">
    <div class="search-box">
        <div class="logo"></div>
        <form action="">
            <input type="text" class="search-input-text">
            <input type="submit" class="search-input-text" value="">
        </form>
    </div>
</div>
</body>
</html>

  

搜索框制作