1.box-flex属性规定框的子元素是否可伸缩其尺寸。
    父元素必须要声明display:box;子元素才可以用box-flex。
    语法:box-flex:value;
    示例:
      <style>
        .test_box {display: -moz-box;display: -webkit-box;display:box;width: 800px;margin: 40px auto;padding: 20px;
            background: #f0f3f9;}
        .list {padding: 0 1em; font: bold 36px/200px monaco;text-shadow: 1px 1px #eee;}
        .list_one { -moz-box-flex: 1;-webkit-box-flex: 1;box-flex: 1;background-color: yellow;}
        .list_two{-moz-box-flex: 2;-webkit-box-flex: 2;box-flex: 2;background-color: #99CC00;}
        .list_three {-moz-box-flex: 1;-webkit-box-flex: 1;box-flex: 1;background-color: paleturquoise;}
      </style>
      <div class="test_box">
        <div class="list list_two">1</div>
        <div class="list list_one">2</div>
        <div class="list list_three">3</div>
      </div>
    结果: 图片

    

    可以指定某个子元素的宽度,剩下的部分平分。
    示例:
      <style>
        .test_box {display: -moz-box;display: -webkit-box;display: box;width: 800px;margin: 40px auto;padding: 20px;
          background: #f0f3f9;}
        .list {padding: 0 1em;font: bold 36px/200px monaco;
          text-shadow: 1px 1px #eee;}
        .list_one {-moz-box-flex: 1;-webkit-box-flex: 1;box-flex: 1;background: #00CC99;}
        .list_two {-moz-box-flex: 2;-webkit-box-flex: 2;box-flex: 2;background: #99FF00;}
        .list_w300 { width: 300px; background: #CCCCFF}
      </style>
      <div class="test_box">
        <div class="list list_two">1</div>
        <div class="list list_one">2</div>
        <div class="list list_w300">3</div>
      </div>
      结果: 图片

      

  2.box-orient
    用来确定子元素的方向,是横着还是竖着。
    可选值:horizontal | vertical | inline-axis | box-axis | inherit inline-axis是默认的 horizonta inline-axis 是一样的让元素横着 vertical
      box-axis 是一样的让元素纵列。
    示例:
      <style>
        .test_box {width: 300px; margin: 0 auto;display: -moz-box;
          display: -webkit-box;display: box;box-orient:horizontal;padding: 20px;background: #f0f3f9;}
        .list{padding: 0 1em;font: bold 36px/120px monaco; text-shadow: 1px 1px #eee;-webkit-box-flex: 1;}
        .one{background: #99FF00;}
        .two{background: #00CC99}
        .three{background:#CCCC00}
      </style>
      <div class="test_box">
        <div class="list one">1</div>
        <div class="list two">2</div>
        <div class="list three">3</div>
      </div>
    结果:如图

  3.box-direction
    用来确定子元素的排列顺序。可选值:
      onrmal | revers | inherit onrmal是默认值按着正常顺序排列,从左到右
      从前到后,revers表示反转。
    示例:
      <style>
         .test_box {display: -moz-box;display: -webkit-box;display: box;-moz-box-direction:reverse;-webkit-box-direction:reverse;
           box-direction:reverse;width: 300px;margin: 20px auto;padding: 10px;background: #f0f3f9;}
         .list {padding: 0 1em;font: bold 36px/150px monaco;text-shadow: 1px 1px #eee;}
         .list_one {-moz-box-flex: 1;-webkit-box-flex: 1;box-flex: 1;background: yellow;}
           .list_two{-moz-box-flex: 2;-webkit-box-flex: 2;box-flex: 2;background: #99CC00;}
         .three{background: #CCCCFF}
      </style>
      <div class="test_box">
        <div class="list list_two">1</div>
        <div class="list list_one">2</div>
        <div class="list list_one three">3</div>
      </div>
    结果: 如图

    

  4.box-align与box-pack
    决定盒子内部剩余空间怎么使用,行为效果为对齐方式。
      box-align 为垂直方向上的空间利用,box-pack 为水平方向上的空间利用。
      box-align 可选参数: start | end | center | baseline | stretch
      stretch为默认父标签的高度有多高,子元素就有多高。start表示底边对齐
      end 为底部对齐,center居中对齐,baseline 基线对齐。
    示例:
      <style>
        .test_box {margin: 0 auto;display: -moz-box;display: -webkit-box;
          display: -o-box;display: box;-moz-box-align:end;
          -webkit-box-align:end; -o-box-align:end; box-align:end;
          width: 300px;height: 200px;padding: 20px;background: #f0f3f9;}
        .list {padding: 0 1em;font: bold 36px/120px monaco;text-shadow: 1px 1px #eee;}
        .one{background: #99FF00;}
        .two{background: #00CC99}
        .three{background:#CCCC00}
      </style>
      <div class="test_box">
        <div class="list one">1</div>
        <div class="list two" style="line-height:200px;">2</div>
        <div class="list three">3</div>
      </div>
    结果:如图

    

    box-pack可选值: start | end | center | justify
      start为默认值, justify表示两端对齐。
    示例:
      <style>
        .test_box {margin: 0 auto;display: -moz-box;display: -webkit-box;
          display: -o-box;display: box;-moz-box-pack:justify;
          -webkit-box-pack:justify; -o-box-pack:justify; box-pack:justify;
          width: 300px;height: 200px;padding: 20px;background: #f0f3f9;}
        .list {padding: 0 1em;font: bold 36px/120px monaco;
          text-shadow: 1px 1px #eee;}
        .one{background: #99FF00;}
        .two{background: #00CC99}
        .three{background:#CCCC00}
      </style>
      <div class="test_box">
        <div class="list one">1</div>
        <div class="list two" style="line-height:200px;">2</div>
        <div class="list three">3</div>
      </div>
    结果:如图

    

  5.box-lines
    用来决定子元素是否可以换行显示,有两个可以选的值:single | mutiple
      single 默认值,不换行。mutiple 换行多行显示。
    示例:
      <style>
        .test_box {margin: 0 auto;display: -moz-box;display: -webkit-box;
          display: -o-box;display: box;-moz-box-lines:multiple;
          -webkit-box-lines:multiple;-o-box-lines:multiple;
          box-lines:multiple; width: 300px;
          height: 200px;padding: 20px;background: #f0f3f9;}
        .list {padding: 0 1em;font: bold 36px/120px monaco;text-shadow: 1px 1px #eee;}
        .one{background: #99FF00;}
        .two{background: #00CC99}
        .three{background:#CCCC00}
      </style>
      <div class="test_box">
        <div class="list one">1</div>
        <div class="list two" style="line-height:200px;">2</div>
        <div class="list three">3</div>
      </div>
    结果:如图

      

  6.box-ordinal-group
    改变子元素的顺序,值为数字,数字越小越排在前面。
    示例:
      <style>
        .test_box {display: -moz-box;display: -webkit-box;display: box;
          width: 300px;margin: 40px auto;padding: 20px;background: #f0f3f9;}
        .list {padding: 0 1em;font: bold 36px/200px monaco;text-shadow: 1px 1px #eee;}
        .list_one {-moz-box-flex: 1;-webkit-box-flex: 1; box-flex: 1;
          -moz-box-ordinal-group: 1;-webkit-box-ordinal-group: 1;box-ordinal-group: 1;background: #99CC00;}
        .list_two{-moz-box-flex: 2;-webkit-box-flex: 2;box-flex: 2;-moz-box-ordinal-group: 2;-webkit-box-ordinal-group: 2;
          box-ordinal-group: 2;background: #CC33CC;}
        .three{ background: #CCCC00}
      </style>
      <div class="test_box">
        <div class="list list_two">1</div>
        <div class="list list_one">2</div>
        <div class="list list_one three">3</div>
      </div>
    结果:如图

    

      demo下载https://github.com/ningmengxs/css3.git

css3弹性盒子模型——回顾。的更多相关文章

  1. css3弹性盒子模型之box-flex

    css3弹性盒子模型之box-flex 浏览器支持 目前没有浏览器支持 box-flex 属性. Firefox 支持替代的 -moz-box-flex 属性. Safari.Opera 以及 Chr ...

  2. css3弹性盒子模型

    当下各种手机,平板尺寸不一,如果盒模型只能固定尺寸,不能随意压缩,将不能很好的迎合这个时代.所以css3推出了新的盒模型——弹性盒子模型(Flexible Box Model). 弹性盒模型可以水平布 ...

  3. CSS3中的弹性盒子模型

    介绍 在css2当中,存在标准模式下的盒子模型和IE下的怪异盒子模型.这两种方案表示的是一种盒子模型的渲染模式.而在css3当中,新增加了弹性盒子模型,弹性盒子模型是一种新增加的强大的.灵活的布局方案 ...

  4. CSS3弹性盒模型flexbox布局基础版

    原文链接:http://caibaojian.com/using-flexbox.html 最近看了社区上的一些关于flexbox的很多文章,感觉都没有我这篇文章实在,最重要的兼容性问题好多人都没有提 ...

  5. css3基础教程:CSS3弹性盒模型

    今天给大家分享一篇关于CSS3基础教程 文章,主要是讲CSS3弹性盒模型.弹性布局的主要思想是让容器有能力来改变项目的宽度和高度,以填满可用空间(主要是为了容纳所有类型的显示设备和屏幕尺寸)的能力. ...

  6. CSS3弹性盒模型布局模块介绍

    来源:Robert’s talk原文:http://robertnyman.com/2010/12/02/css3-flexible-box-layout-module-aka-flex-box-in ...

  7. flexbox弹性盒子模型

    这几天在做移动端的web开发,遇到了一些问题,之前没有折腾过这方面的东西,这次好好吸收下 css3的flexbox--弹性盒子模型,这个盒模型决定了一个盒子在其他盒子中的分布方式及如何处理可用的空间. ...

  8. CSS box-flex属性,然后弹性盒子模型简介

    今天做项目的时候发现一个css3的新属性flex 一.什么是flex 它的作用是能够按照设置好的规则来排列容器内的项目,而不必去计算每一个项目的宽度和边距.甚至是在容器的大小发生改变的时候,都可以重新 ...

  9. CSS box-flex属性,然后弹性盒子模型简介(转)

    一.淡淡的开头语 昨天趁着不想工作的时间间隙闲逛24ways,在My CSS Wish List一文中,见到了个新鲜的CSS属性,就是题目中的box-flex,以前没有见过,顿生疑惑,不知是骡子还是马 ...

随机推荐

  1. Ibatis自动生成dao sqlmapper文件和domain文件过程

    generator自动生成mybatis的xml配置.model.map等信息: 1.下载mybatis-generator-core-1.3.2.jar包.        网址:http://cod ...

  2. HDU 5616 Jam's balance

    背包.dp[i]=1表示i这种差值能被组合出来,差值有负数,所以用sum表示0,0表示-sum,2*sum表示sum. 询问X的时候,只需看dp[sum+X]或者dp[sum-X]是否有一个为1,注意 ...

  3. iOS navigationBar 的isTranslucent属性

    苹果文档: A Boolean value indicating whether the navigation bar is translucent (YES) or not (NO). The de ...

  4. xcode磁盘大清理

     转---Xcode磁盘空间大清理 我的设备是Macbook Air 13’ Mid 2011,128G SSD.最近开始有些存储压力了,用Clean My Mac清理一部分旧文件后,决定对Xcode ...

  5. java中有几种类型的流?JDK为每种类型的流提供了一些抽象类以供继承,请说出他们分别是哪些类?

    java中有几种类型的流?JDK为每种类型的流提供了一些抽象类以供继承,请说出他们分别是哪些类? Java中的流分为两种,一种是字节流,另一种是字符流,分别由四个抽象类来表示(每种流包括输入和输出两种 ...

  6. ID3决策树预测的java实现

    刚才写了ID3决策树的建立,这个是通过决策树来进行预测.这里主要用到的就是XML的遍历解析,比较简单. 关于xml的解析,参考了: http://blog.csdn.net/soszou/articl ...

  7. sencha cmd常用命令汇总

    一.sencha generate:自动生成项目或者代码 1.sencha generate app 项目名称 生成路径 :生成一个新的extjs项目 注明:以上命令会从官网下载试用版本的ext代码到 ...

  8. YII 框架在 MAC OS下 连接数据库失败 提示 DB connection: SQLSTATE[HY000] [2002]

    作者:zccst CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or dire ...

  9. 如何深入学习CSS

    学习CSS有了一定基础后,有的人会觉得好象没有什么学的.因为知道一些基本的理论性的东西.CSS说它容易是因为它的知识点有限.说它难学就在于各浏览器对CSS的支持程度不同.如何深入学习我给出以下几点见意 ...

  10. USB那点事3 -使用端口2作为custom HID的传输(转)

    源:USB那点事3 -使用端口2作为custom HID的传输 USB custom HID例子中是使用了端口1作为通信,那么现在我使用端口2作为通信端了,该如何修改呢?如下所示: 首先修改:usb_ ...