博主信息
博文 22
粉丝 0
评论 0
访问量 19596
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
手机端首页仿写
杰西卡妈妈
原创
603人浏览过
  • 步骤
    1) html文档里写好header, main and footer.
    2) link to css 文档,布局
    3) 添加内容 (后续)

  • 效果

  • 代码html:
    <title>手机端首页仿写</title>
    <link rel="stylesheet" href="static/css/index.css" />
    <link rel="stylesheet" href="static/css/reset.css" />
    <link rel="stylesheet" href="static//icon-font/iconfont.css" />
    <link rel="stylesheet" href="static/css/header.css" />
    <link rel="stylesheet" href="static/css/footer.css" />
    <link rel="stylesheet" href="static/css/nav.css" />
    </head>

    <body>
    <div class="header">
    <div class="search">
    <div class="logo">Top</div>
    <div class="zoom iconfont icon-search"></div>
    <input type="text" class="words" value="womens handbags" />
    </div>

    <a href="" class="login">Sign in</a>
    </div>

    <div class="main">HANDBAGS</div>
    <div class="footer"></div>
    </body>

    • 代码index.css
      @import “reset.css”;
      .header {
      background: darkslategrey;
      color: whitesmoke;
      height: 4.4rem;
      position: fixed;
      left: 0;
      top: 0;
      right: 0;
      z-index.100
      }
      .main {
      position: absolute;
      top: 4.4rem;
      left: 0;
      right: 0;
      bottom: 4.4rem;
      }
      .footer {
      background: darkslategray;
      color: whitesmoke;
      height: 4.4rem;
      position; fixed;
      left: 0;
      bottom: 0;
      right: 0;
      }
  • 代码header.css
    .header .search {
    flex: 6;
    background-color: #fff;
    border-radius: 3rem;
    padding: 0.5rem;

    display: flex;
    }
    .header .search .logo {
    color: #e43130;
    font-size: 2rem;
    flex: 0 1 4rem;
    text-align: center;
    line-height: 2rem;
    }
    .header .search .zoom {
    color: #ccc;
    flex: 0 1 4rem;
    text-align: center;
    line-height: 2rem;
    border-left: 1px solid;
    }
    .header .search .words {
    flex: auto;
    border: none;
    outline: none;
    color: #aaa;
    }

  • 代码footer.css
    .footer {
    display: flex;
    justify-content: space-around;
    align-items: center;
    color: #666;
    }

/ flex支持嵌套布局 /
/ flex的项目可以又是一个flex容器 /
.footer > div {
display: flex;
flex-flow: column nowrap;
/ 主轴垂直,那么交叉轴就是水平 /
align-items: center;
}

.footer > div .iconfont {
font-size: 2rem;
}
.footer > div > span {
font-size: 1rem;
}

.footer > div:hover {
cursor: pointer;
}

本博文版权归博主所有,转载请注明地址!如有侵权、违法,请联系admin@php.cn举报处理!
全部评论 文明上网理性发言,请遵守新闻评论服务协议
0条评论
作者最新博文
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号

  • 登录PHP中文网,和优秀的人一起学习!
    全站2000+教程免费学