作者:05358 | 来源:互联网 | 2023-01-09 09:33
我正在尝试使用CSS Containment(contain: layout
),但在Chrome 62上似乎无法正常工作。
我想知道正确的使用方式contain: layout
或我的误解。
代码在这里:
index.html:
main.js:
const cOntainer= document.querySelector('#container');
setTimeout(() => {
const elem = document.createElement('div');
elem.textCOntent= 'content';
container.appendChild(elem);
}, 100);
我希望#container元素在之后呈现为布局根appendChild(elem)
,但是Chrome开发工具显示该根仍然是#document。
另一方面,contain: layout size
还是contain: strict
正常工作,则意味着#container成为布局根。
其他浏览器尚不支持CSS包含,因此我无法确定它是特定于Chrome还是基于规范。
如果您有任何想法,请帮忙。