博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CSS 概念 Block Inline Containing block
阅读量:6224 次
发布时间:2019-06-21

本文共 2279 字,大约阅读时间需要 7 分钟。

Block 元素 包括 "block-level box," "block container box," and "block box"

首先 display有以下几个属性 inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | none | inherit

block-level boxes: display 为 block | list-item | table

block container boxes: 当设置 display 为 block | list-item | inline-block | table | inline-table | table-cell | table-caption (自己测试总结)

block boxes: block-level boxes that are also block containers are called block boxes.

几点说明:

1. a block-level box is also a block container box
2. Not all block container boxes are block-level boxes, 比如 table-cell | inline-block
3. Floats, absolutely positioned elements, block containers (such as inline-blocks, table-cells, and table-captions) that are not block boxes

-----------------------------------------------------------------------------------

Inline 元素

Inline-level boxes: 当设置 display 'inline', 'inline-table', and 'inline-block'

Inline boxes: Inline-level boxes that are not inline boxes, 比如 'inline-table', and 'inline-block'

-----------------------------------------------------------------------------------
containing block

默认元素的 position 是 static。 其它属性有 relative, absolute, fixed

position: static | relative

the containing block is formed by the content edge of the nearest block container ancestor box.

position: fixed

the containing block is established by the viewport in the case of continuous media or the page area in the case of paged media.(跟它的包裹元素设置 position: relative 或 absolute 没有关系)

position: absolute:

If the element has 'position: absolute', the containing block is established by the nearest ancestor with a 'position' of 'absolute', 'relative' or 'fixed'.
If there is no such ancestor, the containing block is the initial containing block(initial C.B.).
如果所有元素都没有设置 position, 那么html 是 initial C.B. (UA-dependent)

参考文献:

http://www.w3.org/TR/CSS2/visuren.html#block-boxes
http://www.w3.org/TR/CSS2/visuren.html#propdef-display
http://www.w3.org/TR/CSS2/visuren.html#block-formatting

http://www.w3.org/TR/CSS2/visuren.html#inline-boxes

http://www.w3.org/TR/CSS2/visudet.html#containing-block-details

转载于:https://www.cnblogs.com/zhengming2016/p/5535280.html

你可能感兴趣的文章
好程序员带你认识“jQuery”
查看>>
不断重复
查看>>
jquery-event01
查看>>
9,mysql触发器
查看>>
在交换机上拒绝非法的DHCP服务器分配IP地址
查看>>
解决ezSQL编码问题
查看>>
[转]如何用Jmeter做压力测试
查看>>
跨站点如何快速部署DC
查看>>
C#修改目录和文件权限
查看>>
EL表达式
查看>>
深入浅出Hadoop Mahout数据挖掘实战(算法分析、项目实战、中文分词技术)
查看>>
UbuntuServer 12.04安装记录(二):svn服务的创建
查看>>
谈谈最近深圳找工作经历
查看>>
vSphere 5.0 存储特点—简介
查看>>
android 自定义全局未处理异常捕获器
查看>>
12 月29日导入数据库 文件
查看>>
elasticsearch安装教程
查看>>
Windows Server 2008 R2 自定义桌面
查看>>
MYSQL定时任务
查看>>
It’s All Over
查看>>