zoukankan      html  css  js  c++  java
  • Bootstrap源码

    1、Bootstrap

      Bootstrap是美国Twitter公司的设计师Mark Otto和Jacob Thornton合作基于HTML、CSS、JavaScript 开发的简洁、直观、强悍的前端开发框架,使得 Web 开发更加快捷。Bootstrap提供了优雅的HTML和CSS规范,它即是由动态CSS语言Less写成。

    https://www.bootcss.com/

    2、源码解读

    内容块居中,固定宽度

    @media 媒体查询:适应不同屏幕分辨率

    .container {
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
    }
    @media (min- 768px) {
    .container {
    750px;
    }
    }
    @media (min- 992px) {
    .container {
    970px;
    }
    }
    @media (min- 1200px) {
    .container {
    1170px;
    }
    }

    container-fluid类用于 100% 宽度

    .container-fluid {
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
    }

    row代表是一行,通常用来清除浮动

    .row {
    margin-right: -15px;
    margin-left: -15px;
    }

    .row:before,
    .row:after{

    display: table;
    content: " ";
    }

    栅格参数:

    .col-xs-*  超小屏幕,例如手机

     .col-md-* 桌面

      适配两种屏幕

    .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
    position: relative;
    min-height: 1px;
    padding-right: 15px;
    padding-left: 15px;
    }
    .col-xs-1, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9, .col-xs-10, .col-xs-11, .col-xs-12 {
    float: left;
    }
    .col-xs-12 {
    100%;
    }
    .col-xs-11 {
    91.66666667%;
    }
    .col-xs-10 {
    83.33333333%;
    }
    .col-xs-9 {
    75%;
    }
    .col-xs-8 {
    66.66666667%;
    }
    .col-xs-7 {
    58.33333333%;
    }
    .col-xs-6 {
    50%;
    }
    .col-xs-5 {
    41.66666667%;
    }
    .col-xs-4 {
    33.33333333%;
    }
    .col-xs-3 {
    25%;
    }
    .col-xs-2 {
    16.66666667%;
    }
    .col-xs-1 {
    8.33333333%;
    }

     

    列偏移

    .col-xs-offset-12 {
    margin-left: 100%;
    }
    .col-xs-offset-11 {
    margin-left: 91.66666667%;
    }
    .col-xs-offset-10 {
    margin-left: 83.33333333%;
    }
    .col-xs-offset-9 {
    margin-left: 75%;
    }
    .col-xs-offset-8 {
    margin-left: 66.66666667%;
    }
    .col-xs-offset-7 {
    margin-left: 58.33333333%;
    }
    .col-xs-offset-6 {
    margin-left: 50%;
    }
    .col-xs-offset-5 {
    margin-left: 41.66666667%;
    }
    .col-xs-offset-4 {
    margin-left: 33.33333333%;
    }
    .col-xs-offset-3 {
    margin-left: 25%;
    }
    .col-xs-offset-2 {
    margin-left: 16.66666667%;
    }
    .col-xs-offset-1 {
    margin-left: 8.33333333%;
    }

    对齐方式及大小写

    .text-left {
    text-align: left;
    }
    .text-right {
    text-align: right;
    }
    .text-center {
    text-align: center;
    }
    .text-justify {
    text-align: justify;
    }

    .text-nowrap {
    white-space: nowrap;
    }
    .text-lowercase {
    text-transform: lowercase;
    }
    .text-uppercase {
    text-transform: uppercase;
    }

    表格

    .table {
    100%;
    max- 100%;
    margin-bottom: 20px;
    }
    .table > thead > tr > th,
    .table > tbody > tr > th,
    .table > tfoot > tr > th,
    .table > thead > tr > td,
    .table > tbody > tr > td,
    .table > tfoot > tr > td {
    padding: 8px;
    line-height: 1.42857143;
    vertical-align: top;
    border-top: 1px solid #ddd;
    }
    .table > thead > tr > th {
    vertical-align: bottom;
    border-bottom: 2px solid #ddd;
    }ku
    .table > caption + thead > tr:first-child > th,
    .table > colgroup + thead > tr:first-child > th,
    .table > thead:first-child > tr:first-child > th,
    .table > caption + thead > tr:first-child > td,
    .table > colgroup + thead > tr:first-child > td,
    .table > thead:first-child > tr:first-child > td {
    border-top: 0;
    }
    .table > tbody + tbody {
    border-top: 2px solid #ddd;
    }
    .table .table {
    background-color: #fff;
    }
    .table-condensed > thead > tr > th,
    .table-condensed > tbody > tr > th,
    .table-condensed > tfoot > tr > th,
    .table-condensed > thead > tr > td,
    .table-condensed > tbody > tr > td,
    .table-condensed > tfoot > tr > td {
    padding: 5px;
    }
    .table-bordered {
    border: 1px solid #ddd;
    }
    .table-bordered > thead > tr > th,
    .table-bordered > tbody > tr > th,
    .table-bordered > tfoot > tr > th,
    .table-bordered > thead > tr > td,
    .table-bordered > tbody > tr > td,
    .table-bordered > tfoot > tr > td {
    border: 1px solid #ddd;
    }
    .table-bordered > thead > tr > th,
    .table-bordered > thead > tr > td {
    border-bottom- 2px;
    }
    .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: #f9f9f9;
    }
    .table-hover > tbody > tr:hover {
    background-color: #f5f5f5;
    }

    合理使用bootstrap的样式库和margin and padding以及基础的定位可以让页面更加多彩哟


    我是飞奔的企鹅

         一只有梦想、有故事的企鹅。欢迎说出你的故事。 

  • 相关阅读:
    华为机试再回忆--第一题
    TCP快速重传和快速恢复
    MongoDB安装,打开及增,删,改,查
    C++默认构造函数的一点说明
    动态链接库编程范例
    使用skin++进行MFC界面美化范例
    分享下我的博客园CSS
    windows多线程同步总结
    TestDirector 8.0 配置说明
    windows2003安装TestDirector8.0 安装时输入用户名密码 提示错误
  • 原文地址:https://www.cnblogs.com/flyPenguinblog/p/11178365.html
Copyright © 2011-2022 走看看