[CSS 3] content-visibility: auto Improve rendering performance
When page get loaded, browser need to calculate how to render the page even before first pixel get rendered.
Also means that for the content which is outside or viewport, broswer also need to calculate it.
With Chrome 85, if you set parent container to :
.container { content-visibility: auto }
makes the initial user load much faster.
Specifying the natural size of an element with contain-intrinsic-size
#
In order to realize the potential benefits of content-visibility
, the browser needs to apply size containment to ensure that the rendering results of contents do not affect the size of the element in any way. This means that the element will lay out as if it was empty. If the element does not have a height specified in a regular block layout, then it will be of 0 height.
This might not be ideal, since the size of the scrollbar will shift, being reliant on each story having a non-zero height.
Thankfully, CSS provides another property, contain-intrinsic-size
, which effectively specifies the natural size of the element if the element is affected by size containment. In our example, we are setting it to 1000px
as an estimate for the height and width of the sections.
This means it will lay out as if it had a single child of "intrinsic-size" dimensions, ensuring that your unsized divs still occupy space. contain-intrinsic-size
acts as a placeholder size in lieu of rendered content.
.container { content-visibility: auto; contain-intrinsic-size: 1000px; /* Explained in the next section. */ }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2018-09-08 [GraphQL] Query Local and Remote Data in Apollo Link State
2018-09-08 [Spring Boot ] Creating the Spring Boot Project : Demo: Creating a REST Controller
2018-09-08 [Web Analytics] Into to Web Analytics
2016-09-08 [AngularJS] Test an Angular Component with $componentController
2016-09-08 [AngularJS] Isolate State Mutations in Angular Components
2016-09-08 [Jest] Track project code coverage with Jest
2016-09-08 [Javascript] Either Functor