[英]Strange behavior : display table + after pseudo-element
I noticed a strange phenomenon when I apply an :after
pseudo-element on an element with display:table
as you can see here : http://jsfiddle.net/rKzNv/1/ 当我在具有
display:table
的元素上应用:after
伪元素时,我注意到一个奇怪的现象,如您在此处看到的: http : //jsfiddle.net/rKzNv/1/
The pseudo-element may behave like a table cell when it should not. 伪元素应该在不应该像表单元格的情况下那样运行。
Do you have any idea? 你有什么主意吗? Is this a bug?
这是错误吗? Thanks!
谢谢!
From MDN - ::after (:after) 来自MDN-:: after(:after)
The CSS :after pseudo-element matches a virtual last child of the selected element.
CSS:after伪元素与所选元素的虚拟最后一个子项匹配。
So .table:after
matches a virtual child of div.table
, which is allowed to behave as a table cell. 因此
.table:after
匹配.table:after
的虚拟子 div.table
,该子 div.table
可以用作表单元格。
The behaviour changes, when you replace display: table-cell;
替换
display: table-cell;
时,行为会发生变化display: table-cell;
with display: table-row;
与
display: table-row;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.