Answers
首先,display的切换会触发reflow,而visibility不会。
因为w3c的wiki中写到,display的none的解释是This value causes an element to not appear in the document. It has no effect on layout.即display为none的元素会从常规流中删除。
而visibility的none的解释则为The generated box is invisible (fully transparent, nothing is drawn), but still affects layout. Furthermore, descendants of the element will be visible if they have 'visibility: visible'.意思是说当前元素不可见,但是仍然存在于布局中。
reflow我再继续写点。。。慢点更新。。。
引用:
Notes on HTML Reflow
CSS/Properties/visibility - W3C Wiki
CSS/Properties/display - Web Education Community Group
消逝的热情
answered 10 years, 8 months ago