码迷,mamicode.com
首页 > 其他好文 > 详细

display: run-in

时间:2016-01-27 17:05:16      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:

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元素,那么如果后面跟着一个图片,他就不会自动换行
 

display: run-in

标签:

原文地址:http://www.cnblogs.com/chuangweili/p/5163797.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!