zoukankan      html  css  js  c++  java
  • 高级布局补充.过滤以及动画

    一.Flex布局

    1.概念

    下图为flex的相关概念示意图

    ​ 使用flex布局的容器(flex container),他内部的元素自动成为flex项目(flex item).容器拥有两根隐性的轴,水平的主轴(main axis),竖直的交叉轴(cross axis).主轴开始的位置,即主轴与有边框的交点,称为main start;主轴结束的位置称为main end;交点轴开始的位置称为cross start;交叉轴结束的位置称为cross end.item按主轴或交叉轴排列,item在主轴方向上占据的宽度称为main size,在交叉轴方向上的宽度称为cross size.

    ​ 注意:设为flex布局以后,子元素的float,clear和vertical-align属性将失效.

    2.容器属性

    1.flex-direction属性 决定主轴的方向(即项目的排列方向)
    flex-direction: row | row-reverse | column | column-reverse;
    -- row(默认值):主轴为水平方向,起点在左端。
    -- row-reverse:主轴为水平方向,起点在右端。
    -- column:主轴为垂直方向,起点在上沿。
    -- column-reverse:主轴为垂直方向,起点在下沿。
    
    2.flex-wrap 属性定义,如果一条轴线排不下,如何换行。
    flex-wrap: nowrap | wrap | wrap-reverse;
    -- nowrap(默认):不换行。
    -- wrap:换行,第一行在上方。
    -- wrap-reverse:换行,第一行在下方。
    
    3.flex-flow 属性是flex-direction属性和flex-wrap属性的简写形式,默认值为row nowrap。
    flex-flow: <flex-direction> <flex-wrap>;
    
    4.justify-content 属性定义了项目在主轴上的对齐方式。
    justify-content: flex-start | flex-end | center | space-between | space-around;
    
    5.align-items 属性定义项目在交叉轴上如何对齐。
    align-items: flex-start | flex-end | center | baseline | stretch;
    
    6.align-content 属性定义了多根轴线的对齐方式。如果项目只有一根轴线,该属性不起作用。
    align-content: flex-start | flex-end | center | space-between | space-around | stretch;
    

    3.项目属性

    1.order 属性定义项目的排列顺序。数值越小,排列越靠前,默认为0。
    order: <integer>;
    
    2.flex-grow 属性定义项目的放大比例,默认为0,即如果存在剩余空间,也不放大。
    flex-grow: <number>; /* default 0 */
    
    3.flex-shrink 属性定义了项目的缩小比例,默认为1,即如果空间不足,该项目将缩小。
    flex-shrink: <number>; /* default 1 */
    
    4.flex-basis 属性定义了在分配多余空间之前,项目占据的主轴空间(main size)。
    flex-basis: <length> | auto; /* default auto */
    
    5.flex 属性是flex-grow, flex-shrink 和 flex-basis的简写,默认值为0 1 auto。后两个属性可选。
    flex: <flex-grow> <flex-shrink> <flex-basis>
    
    6.align-self 属性允许单个项目有与其他项目不一样的对齐方式,可覆盖align-items属性。默认值为auto,表示继承父元素的align-items属性,如果没有父元素,则等同于stretch。
    align-self: auto | flex-start | flex-end | center | baseline | stretch;
    

    二.响应式布局

    1.基本语法

    • 小于<integer>宽度
    @media only screen and (max- <integer>) {
        selector {
            
        }
    }
    
    • 大于<integer>宽度小于<integer>宽度
    @media only screen and (min- <integer>) and (max- <integer>) {
        selector {
            
        }
    }
    
    • 大于<integer>宽度
    @media only screen and (min- <integer>) {
        selector {
            
        }
    }
    

    2.注意

    1.在响应式布局中,css语法同正常样式表语法.
    2.响应式布局之间存在不同屏幕尺寸的限制,使用样式互相不影响.
    3.当响应式布局中样式块起作用,会与正常样式块设置协同布局,遵循选择器的优先级.
    

    三.过滤transition

    1.属性

    transition-property 过滤属性

    该属性表示可过滤的样式属性

    值:none | all | [css1 [...]]

    默认值:all

    none:没有指定任何样式
    all:默认值,表示指定元素所有支持transition-property属性的样式
    [css1 ,[...]]:可过滤的样式,可用逗号分开写多个样式
    

    **transition-duration 过滤持续时间 **

    该属性的单位为秒(s)或毫秒(ms)

    值:time[,time]*

    默认值:0s

    注意:该属性不能为负值,该值为单值时,即所有过渡属性都对应同样时间;该值为多值时,过滤属性按照顺序对应持续时间.
    

    transition-delay 过滤延迟时间

    该属性定义元素属性延迟多少时间后开始过滤效果,该属性的单位为秒(s)或毫秒(ms)

    值:time[,time]*

    默认值:0s

    注意:该属性若为负值,无延迟效果,但过滤元素的起始值将从0变成设定值(设定值=延迟时间+持续时间)若该设定值小于等于0,则无过渡效果;若该设定值大于0,则过渡元素从该设定值开始完成剩余的过渡效果
    

    transition-timing-function 过滤时间函数

    该属性用于定义元素过滤属性随时间变化的过滤速度变化效果

    值:linear | ease | ease-in-out | easa-in | ease-out | cubic-bezier()

    默认值:ease

    linear:匀速
    ease:慢快慢
    ease-in-out:慢快慢,和ease类似,但是比ease幅度大
    easa-in:慢快
    ease-out:快慢
    cubic-bezier():贝赛尔曲线函数
    

    transition属性

    该属性表示前四个属性整体赋值

    transition: (transition-property transition-duration transition-dela> transition-timing-function);

    四.动画

    1.概念

    动画是使元素从一种样式逐渐变化为另一种样式的效果。
    可以改变任意多的样式任意多的次数。
    请用百分比来规定变化发生的时间,或用关键词 "from" 和 "to",等同于 0% 和 100%。
    0% 是动画的开始,100% 是动画的完成。
    为了得到最佳的浏览器支持,应该始终定义 0% 和 100% 选择器。
    

    2.属性

    animation-name 属性

    该属性表示规定需要绑定到选择器的keyframe名称.

    animation-name:name;

    animation-duration 属性

    该属性表示动画持续时间
    animation-duration: time;

    animation-delay 属性

    该属性表示动画延迟时间
    animation-delay: time;

    animation-timing-function 属性

    该属性表示动画运动曲线
    animation-timing-function: linear | ease | ease-in-out | easa-in | ease-out | cubic-bezier();

    linear:匀速
    ease:慢快慢
    ease-in-out:慢快慢,和ease类似,但是比ease幅度大
    easa-in:慢快
    ease-out:快慢
    cubic-bezier():贝赛尔曲线函数
    

    animation-play-state 属性

    该属性表示动画状态
    animation-play-state: running | paused

    running:运行
    paused:暂停
    

    animation-fill-mode 属性

    该属性表示动画结束后的停留位置
    animation-fill-mode: forwards | backwards

    forwards:终点 
    backwards:起点
    

    animation-iteration-count 属性

    该属性表示动画次数
    animation-iteration-count: count | infinite

    count:固定次数
    infinite:无限次
    

    animation-direction 属性

    该属性表示运动方向
    animation-direction: normal | alternate | alternate-reverse;

    normal:原起点为第一次运动的起点,且永远从起点向终点运动
    alternate:原起点为第一次运动的起点,且来回运动
    alternate-reverse:原终点变为第一次运动的起点,且来回运动
    
  • 相关阅读:
    set集合操作
    python中字符串操作
    字典----增删改查遍历
    C#反射回顾笔记
    消息队列之ActiveMQ学习笔记(二、C#实例实现)
    消息队列之ActiveMQ学习笔记(一、下载及安装)
    依赖注入之AutoFac
    layer弹框层学习笔记
    VS自定义代码块Code Snippet
    博客园添加链接
  • 原文地址:https://www.cnblogs.com/louyefeng/p/9714097.html
Copyright © 2011-2022 走看看