模仿百度搜索界面

下面是我模仿百度首页所写的Html和css代码,在写代码测试的时候,发现了个小问题,就是两个button之间有间距,和之间,刚开始先想到的是margin问题,设置margin为0也不行,最后才恍然大悟,原来要设置float属性,也就是float:left。

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <meta charset="utf-8" />
    <style type="text/css">
        *{padding:0px; margin:0px;}
        .bg-search-img{width:100%; height:720px; background-image:url(img/bg1.jpg); margin:0 auto;}
        .search-logo{text-align:center;}
         .search-btn{ margin:0 auto; width:640px; height:40px;}
         .search-text{height:20px; width:521px; padding:9px 7px; border:1px solid #b8b8b8; outline:none; margin-right:0px; float:left;}
         .search-sub{height:40px; background-color:#38f; border:none; padding:1px; line-height:38px; width:102px;color:white; font-size:16px;margin:0px; float:left;}
    </style>
</head>
<body>
    <div class="bg-search-img">
        <div class="search-conent">
            <div class="search-logo">
                <img src="img/bdlogo.png" />
            </div>
            <div class="search-btn">
                <form >
                    <input type="text" class="search-text" />
                    <input type="submit" class="search-sub" value="百度一下" />
                </form>
            </div>
        </div>

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

效果图如下:效果图

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值