01_前端框架之Bootstrap的应用

day01_前端框架之Bootstrap的应用

本课目标

  • 能够完成 Bootstrap 环境搭建
  • 能够理解 Bootstrap 的栅格布局
  • 能够根据 Bootstrap 相关文档使用Bootstrap组件
  • 能够根据 Bootstrap 重构主页和表单页

第1章 bootstrap简介

1.1 什么是bootstrap
  • Bootstrap 是全球最受欢迎的前端组件库,用于开发响应式布局、移动设备优先的 WEB 项目。

    • Bootstrap 是一套用于 HTML、CSS 和 JS 开发的开源工具集。

  • Bootstrap,基于 HTML、CSS、JAVASCRIPT 的前端框架。 该框架已经预定义了一套CSS样式和与样式对应的JS代码。(对应的样式有对应的特效) 开发人员只需要编写HTML结构,添加bootstrap固定的class样式,就可以轻松完成指定效果的实现。

  • 作用:

    • Bootstrap 使得 Web 开发更加快捷,高效。

    • BootStrap支持响应式开发,解决了移动互联网前端开发问题。

    • Bootstrap英文官网: Bootstrap · The most popular HTML, CSS, and JS library in the world.

    • Bootstrap4 中文文档参考: 简介 · Bootstrap

1.2 什么是响应式布局
  • 响应式布局:一个网站的展示能够兼容多个终端(手机、iPad、PC等),而不需要为每个终端单独做一个 展示版本。此概念专为解决移动互联网浏览而诞生的。

  • 响应式布局,使得网站仅适用一套样式,就可以在不同分辨率下展示出不同的舒适效果,大大降低了网站开 发维护成本,并且能带给用户更好的体验性。

  • 响应式布局会增加程序员负担以及代码量

  • 未使用响应式开发:

    • 百度: 百度一下,你就知道 无论如何缩小窗口在屏幕下都是不变的

    • 百度针对不同的设备有不同的网页匹配: 手机端: 百度一下

第2章 bootstrap环境搭建

2.1 下载bootstrap
  • 地址:https://code.z01.com/v4/bootstrap-4.4.1-dist.zip

  • 目录结构:目录结构 · Bootstrap

第3章 bootstrap页面布局

3.1 基础入门
  • Container容器是窗口布局的最基本元素,我们推荐所有样式都定义在.container.container-fluid容器之中-- 这是启用整个栅格系统必不可少的前置条件,它们分别对应选择一个响应式的、固定宽度的容器,或者选择一个流式自适应浏览器或容器最大合法宽度的窗口(意味着任何时候它的宽度总是100%)。

  • Bootstrap原生带三种container宽度规范:

    • .container, 居中,适配不同的断的 max-width 尺寸。

    • .container-fluid, 全屏,适配屏幕的 width: 100% 尺寸。

超小屏幕 <576px 小屏幕 ≥576px 中等屏幕 ≥768px 大屏幕 ≥992px 超大屏幕 ≥1200px
.container 100% 540px 720px 960px 1140px
.container-sm 100% 540px 720px 960px 1140px
.container-md 100% 100% 720px 960px 1140px
.container-lg 100% 100% 100% 960px 1140px
.container-xl 100% 100% 100% 100% 1140px
.container-fluid 100% 100% 100% 100% 100%
  • 课堂案例:01.Bootstrap远程样式引入.html

  • 
    
    
        
        
        
        Bootstrap入门
        
         
         
         
         
    
    
        hello Bootstrap入门
    
    

  • 课堂案例:02.Boostrap本地样式引入.html

  • 
    
    
        
        
        
        Bootstrap通过本地样式引入
        
         
         
         
         
    
    
        

    hello Bootstrap

    hello Bootstrap

  • 课堂案例:03.container页面布局规范.html

  • 
    
    
        
        
        
        Contain 容器
    
        
        
        
        
    
        
        
    
    
        
        

    hello 酷狗

    哈哈哈哈

3.1 栅格系统
  • 为了方便在布局容器中进行网页的布局操作。BootStrap提供了一套专门用于响应式开发布局的栅格系统。 栅格系统将一行分为12列,通过设定元素占用的列数来布局元素在页面上的展示位置。

  • 栅格特点 “行(row)”包含在 .container或 container-fluid(100% 宽度)中行使用的样式

  • 课堂案例:04.Bootstrap栅格系统1.html

  • 
    
    
    
        
        
        
        Document
    
        
        
        
        
    
        
    
    
    
    
        
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    5
    5
    2
    4
    8
    6
    -----------
    4
    3
    9
    4
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12

  • 课堂案例:05.Bootstrap栅格系统2.html

  • 
    
    
    
        
        
        
        Document
    
        
        
        
        
    
        
    
    
    
        
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    6
    4
    2
    1
    11

  • 课堂案例:06.Bootstrap栅格系统3.html

  • 
    
    
    
        
        
        
        等宽布局
    
        
        
        
        
    
        
    
    
    
        
    col
    col
    col
    col
    8
    4
    col
    col
    col
    col
    col

第4章 bootstrap公共样式&内容

  • 课堂案例:07.Bootstrap的内容.html

  • 
    
    
    
        
        
        
        内容
    
        
        
        
        
    
        
    
    
    
        
        

    h1. Bootstrap heading

    h2. Bootstrap heading

    h3. Bootstrap heading

    h4. Bootstrap heading

    h5. Bootstrap heading

    h6. Bootstrap heading

    Display 1

    Display 2

    Display 3

    Display 4

    • 列表之一
    • 列表之二
    • 列表之三
    Responsive image
    # First Name Last Name Username
    1 Mark Otto @mdo
    2 Jacob Thornton @fat
    3 Larry the Bird @twitter

  • 课堂案例:08.Bootstrap的公共样式.html

  • 
    
    
    
        
        
        
        公共样式
    
        
        
        
        
    
    
    
    
        1111
        2222
        3333
        44444
        55555
    
        111111
        1111111
        1111111
        11111111
        11111111
        11111111
        1111111
        1111111111
        1111111111
    
        

    .text-primary

    .text-secondary

    .text-success

    .text-danger

    .text-warning

    .text-info

    .text-light

    .text-dark

    .text-body

    .text-muted

    .text-white

    .text-black-50

    .text-white-50


    Primary link

    Secondary link

    Success link

    Danger link

    Warning link

    Info link

    Light link

    Dark link

    Muted link

    White link


    .bg-primary
    .bg-secondary
    .bg-success
    .bg-danger
    .bg-warning
    .bg-info
    .bg-light
    .bg-dark
    .bg-white
    .bg-transparent

第5章 bootstrap常用组件

5.1 按钮的样式
  • 课堂案例:09.按钮组件.html

  • 
    
    
    
        
        
        
        Document
    
        
        
        
        
    
    
    
    
        
        
        
        
        
        
        
        
    
        
    
        
    Primary link Link

5.2 轮播图
5.3 导航条
5.4 表单样式(最重要的)
  • 课堂案例:12.表单组件1.html

  • 
    
    
    
        
        
        
        12.表单组件1.html
    
        
        
        
        
    
    
    
    
        
    
        







  • 课堂案例:13.表单组件2.html

  • 
    
    
    
        
        
        
        表单校验
    
        
        
        
        
    
    
    
    
        
    
        
    满足要求
    密码输入不符合要求
    @
    Please choose a username.
    Please provide a valid city.
    Please provide a valid state.
    Please provide a valid zip.
    You must agree before submitting.

第6章 bootstrap综合案例

  • 课堂案例:14.注册页面开发.html

  • 
    
    
    
        
        
        
        Document
    
        
        
        
        
    
        
    
        
    
    
    
        
        
                
    新用户注册
    手机号必须是未注册过的.
    密码必须是6-16位
    两次密码不一致
    邮箱不符合格式

你可能感兴趣的:(前端框架,bootstrap,前端)