HTML5CSS3实现移动端的头部、导航和底部

1.Header 

HTML部分:

<div class="wrap">
        <!-- header -->
        <header>
            <a href="#">
                <img src="./images/index/logo.jpg" alt="logo">
            </a>
            <form action="#" method="get">
                <input type="text" name="" placeholder="寻找商品">
            </form>
            <i class="iconfont icon-gengduo-copy"></i>
        </header>
</div>

CSS部分:

.wrap {
  width: calc(100% - 20px*2);
  max-width: 750px;
  margin: 0 auto;
}
.wrap header {
  height: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wrap header form input {
  width: 3.06rem;
  height: 0.4rem;
  background-color: #EEEEEE;
  border-radius: 0.07rem;
  text-align: center;
  font-size: 0.16rem;
}
.wrap header form input::-webkit-input-placeholder {
  color: #C9C9C9;
}
.wrap header i {
  font-size: 0.55rem;
}

HTML部分:

  <div class="wrap headerbg">
        <header>
            <a href="#">
                <img src="../images/iconimg/arrleft_03.jpg" alt="arrleft">
            </a>
            <h3>商品分类</h3>
            <i class="iconfont icon-gengduo-copy"></i>
        </header>
    </div>

CSS部分:

.headerbg {
  background-color: #f26b11;
}
.wrap {
  width: 100%;
  max-width: 750px;
  margin: 0 auto;
}
.wrap header {
  width: calc(100% - 30px*2);
  height: 0.9rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wrap header a img {
  width: 0.17rem;
  height: 0.28rem;
}
.wrap header h3 {
  font: 0.35rem/1 "微软雅黑";
  color: #fefcff;
}
.wrap header i {
  font-size: 0.55rem;
  color: #fefcff;
}

 

2.Navigation导航部分

 HTML部分:

  <div class = "wrap">  
        <nav>
            <ul class="list">
                <li><a href="#">推荐</a></li>
                <li><a href="#">女装</a></li>
                <li><a href="#">鞋包</a></li>
                <li><a href="#">居家</a></li>
                <li><a href="#">母婴儿童</a></li>
                <li><a href="#">美食</a></li>
                <li><a href="#">男装</a></li>
                <li><a href="#">运动</a></li>
                <li><a href="#">品牌</a></li>
                <li><a href="#">奥莱</a></li>
                <i class="downarrow iconfont icon-jiantou8"></i>
            </ul>
        </nav>
    </div>

CSS部分:

.wrap nav {
  width: 100%;
  height: 0.75rem;
}
.wrap nav .list {
  width: 100%;
  height: 100%;
  white-space: nowrap;
  overflow-x: scroll;
  overflow-y: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  padding-left: 0.1rem;
  position: relative;
}
.wrap nav .list li {
  flex-grow: 1;
  margin-right: 0.4rem;
}
.wrap nav .list li a {
  display: inline-block;
  font: bold 0.28rem/0.71rem "微软雅黑";
  color: #494949;
}
.wrap nav .list li a:hover {
  color: #C54473;
  border-bottom: 4px solid #C54473;
}
.wrap nav .list .downarrow {
  display: block;
  width: 0.75rem;
  height: 0.75rem;
  line-height: 0.75rem;
  position: absolute;
  background-color: #ffffff;
  top: 0;
  right: -0.2rem;
  font-size: 0.4rem;
  text-align: center;
  color: #c3c3c3;
}
.wrap nav .list::-webkit-scrollbar {
  display: none;
}

3.底部tabnav

 

HTML部分:

 <div class="tabnav">
        <a href="#">
            <i class="iconfont icon-shouye1"></i>
            <em>首页</em>
        </a>
        <a href="#">
            <i class="iconfont icon-48"></i>
            <em>购物车</em>
        </a>
        <a href="#">
            <i class="iconfont icon-iconfuzhi"></i>
            <em>我的</em>
        </a>
    </div>

CSS部分:

.tabnav {
  width: 100%;
  max-width: 750px;
  height: 1.4rem;
  border-top: 1px solid #ebebeb;
  background-color: #ffffff;
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.tabnav a {
  text-align: center;
}
.tabnav a i {
  display: block;
  font-size: 0.5rem;
  color: #8a8a8a;
}
.tabnav a em {
  font: 0.2rem/0.32rem "微软雅黑";
  color: #878787;
}
.tabnav a:nth-of-type(1) i,
.tabnav a:nth-of-type(1) em {
  color: #ef6b16;
}

 

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值