您的位置:首页 > 其它

display: run-in

2016-01-27 16:46 218 查看
If a sibling block box (that does not float and is not absolutely positioned) follows the run-in box, the run-in box becomes the first inline box of the block box.
如果兄弟元素不是浮动和绝对定位,那么就会表现得像紧接着那个块元素的第一个行内元素

A run-in cannot run in to a block that already starts with a run-in or that itself is a run-in.
不可以跑进已经由run in开头,或者本省就是run in的元素里

If the run-in element contains anything block-level, it becomes block-level

可以让标题和后面的文字出现在同一行,不用牺牲语义化,用其他方式实现容易遇到各种问题

h3{display:run-in}





例如用float来实现,会错开





如果把标题变为inline元素,那么如果后面跟着一个图片,他就不会自动换行
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: