Web前端速成(Html+Css+JavaScript+jQuery)-14.页面布局

  • 内容摘要:
    • 以案例为分析讲解页面布局的思路

14.页面布局

知识点:

  • 把文字,图片,链接等html元素通过css的样式设定,按美工设计的样式在页面指定的位置展示出来这样的过程就是页面布局过程。

  • 页面布局思路

    • step1
      • 分析页面整体结构
      • 实现整体页面框架布局
        • HTML设置布局元素
        • CSS写样式文件
        • 调试预览
    • step2
      • 分析页面局部结构
  • 编写顺序原则先全局再到局部,按从上到下,从外到里的顺序。

实例分析:

备注:

  • 请亲自动手模仿着去实践。
  • 整体页面结构提供了分析和代码。
  • 局部部分请按整体页面的实现思路去实践。
以京东官网首页参考

https://global.jd.com/

  • 分析页面结构。

    • (1)整体页面划分
      在这里插入图片描述
  • 实现整体页面框架布局
    - 设置HTML布局元素

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>整体页面划分布局</title>
      <link rel="stylesheet" type="text/css" href="all.css?v=4">   
    </head>
    <body>
    	  <div id="topBanner" >
    	  </div>
    	  <div id="header" >
    	  </div>
    	  <div id="middle">
    	    <div class="content">
    	      <div class="floor f1">
    	      </div>
    	      <div class="floor f2">  
    	      </div>
    	      <div class="floor f3">  
    	      </div>
    	    </div> 
    	  </div>
    	  <div id="bottom">   
    	  </div>  
    </body>
    </html>
    
  • 写CSS样式文件

     /*全局属性设定*/body {
        -webkit-font-smoothing: antialiased;
        background: #f5f5f5;
        color: #666;
        font-family: Microsoft YaHei;
        font-size: 12px;  
    }
    
    a, address, b, big, blockquote, body, center, cite, code, dd, del, div, dl, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, html, i, iframe, img, ins, label, legend, li, ol, p, pre, small, span, strong, u, ul, var {
        margin: 0;
        padding: 0;
    }
    
    div {
        display: block;
    }
    
    /*Banner设定*/
    #topBanner {
        width: 100%;
        height: 30px;
        line-height: 30px;
        background: #e3e4e5;
        border-bottom: solid 1px #ddd;
    }
    
    /*头部设定*/
    #header {
        background: #f0f3ee;
        height: 139px;
    }
    
    /*中部设定*/
    #middle {
        width: 100%;
        /*此处background便于查看元素位置用,实际使用时要清理*/
        background: #94a38a;    
    }
    /*中部内容设定*/
    .content {
        width: 100%;
        height: 1050px;
        /*此处background便于查看元素位置用,实际使用时要清理*/     
        background: #2626dd;
    }
    /*中部内容公共部分设定*/
    .floor {
        margin-left: auto;
        margin-right: auto;
        width: 1190px; 
        overflow: unset;
        position: relative;
        /*此处background便于查看元素位置用,实际使用时要清理*/
        background: #e4eadf;   
    }
    /*中部内容各部分设定*/
    .f1 {
        height: 250px;   
        /*此处background便于查看元素位置用,实际使用时要清理*/
        background: #26dd4b;
    }
    .f2 {    
        height: 350px;
        /*此处background便于查看元素位置用,实际使用时要清理*/
        background: hsl(53, 81%, 55%);
    }
    .f3 {
        height: 450px;
        /*此处background便于查看元素位置用,实际使用时要清理*/
        background: #f22f35;
    }
    /*底部设定*/
    #bottom {
        background: #3d860b;
        height: 150px;
    }
    

2.) 分析页面局部结构-部分例子

  • topBanner
    在这里插入图片描述
  • middle
    在这里插入图片描述

Web前端速成(Html+Css+JavaScript+jQuery)

  1. 前言
  2. 初识HTML
  3. 基本标签
  4. 属性
  5. 文本格式化
  6. 链接
  7. 图片(Images)
  8. 分组
  9. 无序列表
  10. 有序列表
  11. 自定义列表
  12. 表格(Tables)
  13. CSS
  14. 页面布局
  15. 表单(Forms)
  16. 认识JavaScript
  17. jQuery-前后台数据交互
  18. 知识总结与就业指导
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

乐地课堂

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

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

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

打赏作者

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

抵扣说明:

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

余额充值