day10 html5

   day10知识点

Element type conversion:
display attribute:
attribute value:
1.block
2.inline
3.none
Note: most block elements default display value block, where li default value list-item (list element)
most inline The default display value of the element is inline, where the default value of input is inline-block (inline block element)

The special one of the inline elements: inline block elements (inline block elements)
features:
1: width and height can be set
2: displayed one by one in a line
3: the display value of the current element is inlin-block can support vertical-align attribute

vertical-algin :; vertical alignment
property value top
bottom
middle
baseline

让一个元素在父元素里面左右上下居中。
    1:给父元素添加text-align:center (左右居中)
    2:给当前元素添加
        display:inline-block;
        vertical-align:middle;
    3:在当前元素后面(不要回车),添加一个空的span
        给span设置样式:
            display:inline-block;
            width:0;
            height:100%;
            vertical-align:middle;

Classification of element types:
block elements, inline elements, variable elements

元素类型的转换:
    display属性:
        属性值:
            block
            inline
            inline-block
            none
            list-item


行内块元素:input      display为inline-block
img标签:浏览器默认解析的display的值inline

标签的嵌套规则:
    1:尽量让块状元素作为父元素(容器)存在
    2: 内联元素的子元素尽量也是内联元素
    3: p标签中不能出现h1 - h6
    4:p标签 h1 - h6  不能互相嵌套

Positioning: Let the position of the element change.

css定位需要几步:
    1: 让元素知道自己要做位置的变动。
    2:确定谁是参照物
    3:指定固定的坐标

定位属性: position属性:设置或检索元素定位方式。

(If the element has a position attribute, the element knows that it needs to move the
position ) The attribute value of position: (The attribute value tells the element who the reference object is)

指定坐标:left\right\top\bottom
position的属性值:
    1: position:static 【静态定位】 (默认值:添加和不设置的效果一样的)

    2: position:absolute  【绝对定位】
        a: 绝对定位的参照物:
            已经有定位的父元素为参照物
            如果父元素都没有定位或者没有父元素,以整个文档为参照物。
        b: 绝对定位的特点:
            不占据空间,脱离布局流
Published 21 original articles · praised 0 · visits 288

Guess you like

Origin blog.csdn.net/jiatinghui/article/details/105151454