购物网站制作——头部header(index.html)

1. 头部header

在这里插入图片描述

1.1 logo图片定位

在这里插入图片描述
在这里插入图片描述

  • css代码写在common.css里面
  • 调用了.w类:版心
.w {
	width : 1200px;
	margin: 0 auto;
}
.header {
    position: relative;
    height: 90px;
    background-color: #c81623;
}

.header h1 {
    position: absolute;
    top: 10px;
    left: 0;
    width: 250px;
    height: 70px;
    background-color: aqua;
}

.header h1 a {
    display: block;
    width: 250px;
    height: 70px;
    background: url(../images/logo.jpg) no-repeat;
    background-size: 250px 70px;
    font-size: 0;
}
    <header class="header w">
        <h1>
            <a href="#" title="昕之优选官网">昕之优选购物网站</a>
        </h1>
    </header>
  • 给a标签一个title,鼠标经过图片时有文字提示
  • 最后要把给的背景颜色都删除

1.2 search搜索框

在这里插入图片描述
在这里插入图片描述

 <!-- 搜索框 -->
        <div class="search">
            <input type="search" name="" id="" placeholder="请输入" />
            <button>搜索</button>
        </div>
.search {
    position: absolute;
    top: 16px;
    left: 400px;
    width: 490px;
    height: 36px;
    border: 2px solid #ed3947;
    border-radius: 5px;
}

.search input {
    position: absolute;
    top: 0;
    left: 0;
    width: 400px;
    height: 32px;
    padding-left: 12px;
}

.search button {
    position: absolute;
    top: 0;
    right: 0;
    width: 90px;
    height: 34px;
    background-color: #ed3947;
    font-size: 16px;
    color: #fff;
}

1.3 热搜词

在这里插入图片描述

在这里插入图片描述

  • 热搜词的宽和高与搜索框一样,定位时,top值大一点
.hotwords {
    position: absolute;
    top: 57px;
    left: 400px;
    width: 490px;
    height: 36px;
}

.hotwords a {
    margin: 0 10px;
}
 <!-- 热搜词 -->
        <div class="hotwords">
            <a href="" class="style_red">海外直购</a>
            <a href="">优选自有品牌</a>
            <a href="">品质奶粉</a>
            <a href="">人气面膜</a>
            <a href="">华为手机</a>
            <a href="">电器专卖</a>
        </div>

1.3 购物车

在这里插入图片描述在这里插入图片描述

<!-- 购物车 -->
        <div class="shopcart">
            我的购物车
        </div>
.shopcart {
    position: absolute;
    top: 16px;
    right: 74px;
    width: 144px;
    height: 36px;
    line-height: 34px;
    text-align: center;
    font-size: 15px;
    color: #000;
    border: 2px solid #ed3947;
    border-radius: 5px;
    background-color: #f1f1f1;
}

.shopcart::before {
    content: '';
    font-family: 'icomoon';
}

.shopcart::after {
    content: '';
    font-family: 'icomoon';
}

1.4 提示信息

在这里插入图片描述

  • position:absolute;定位top为负值
  • border-radio:左上 右上 右下 左下;圆角边框,左下为0
  • padding:上下 左右;内边距上下为0左右有距离
    在这里插入图片描述
  • 4
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

素心如月桠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值