html+css:5.搜索框定位練習

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        @font-face {
        font-family: 'iconfont';
        src: url('./font/iconfont.ttf?t=1722477916565') format('truetype');
        }
        .iconfont {
            font-family: "iconfont" !important;
            font-size: 16px;
            font-style: normal;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            }

        body{
            padding: 0;
            margin: 0;
            background-color: #F5F5F5;
            font-size: 16px;
            font-family: Arial, Helvetica, sans-serif;
            
        }
        .clearfix::after{
            content: "";
            display: block;
            clear: both;
        }
        .fl{
            float: left;
        }
        .fr{
            float: right;
        }
        .layer{
            margin: 0 auto;
        }

        #centerlogo{
            width: 600px;
            height: 200px;
            /* border: 1px solid red; */
        }


        #search{
            width: 800px;
            height: 100px;
            position: relative;
            /* border: 1px solid blue; */
            
        }


        #search .inputtext{
            position: absolute;
            left:0px;
            top:5px;
            height: 33px;
            line-height: 33px;

        }

        #search .placeholder{
            border: 2px solid red;
            width: 750px;
            height: 42px;
            line-height: 42px;
            border-radius: 20px 0px 0px 20px;
            overflow: hidden;
            padding-left: 12px;
            position:absolute;
            box-sizing: border-box;
            border-right: none;

        }
        #search .inputtext{
            position:absolute;
            width: 700px;
            height: 33px;
            line-height: 33px;
            vertical-align: middle;
            background-color: transparent;
            outline: none;
            border: none;
            z-index: 2;
            left: 20px;


        }


        #search .camera{
            display: inline-block;
            font-size: 20px;
            height: 40px;
            line-height: 40px;
            width: 30px;
            text-align: center;
            margin-right: 15px;
        }

        
        #search .btn{
            position: absolute;
            left: 750px;
            height: 42px;
            line-height: 42px;
            width: 80px;
            background-color: #f40;
            border: none;
            color:white;
            font-size: 20px;
            font-weight: bold;

        }
    </style>
</head>
<body>

    <div id="centerlogo" class="layer">

    </div>


    <div id="search" class="layer clearfix">
        <input type="text" class="inputtext">
        <div class="placeholder fl">
            <span class="iconfont">&#xe512;</span>
            <span>搜索一下,世界更精彩</span>
            <span class="iconfont camera fr">&#xe6f4;</span>

        </div>
        <button class="btn fr">搜索</button>


    </div>
    
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值