Performance: Visibility utilities
Visibility utilities affect how elements are shown or hidden, impacting rendering and layout calculations during page load and interaction.
class="invisible"
class="d-none"
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using d-none (display:none) | Removes element from layout | Triggers reflow | Paint cost moderate | [X] Bad |
| Using invisible (visibility:hidden) | Element remains in layout | No reflow | Paint cost low | [OK] Good |
d-none do to an element?d-none class purposed-none class sets display: none; on the element, hiding it completely.d-none hides element fully [OK]d-none means no display at all [OK]d-none with invisibled-none hides the element on all screen sizes. d-md-block makes it display block starting at medium screens and up.d-none d-md-block hides the element on small and extra small screens, shows it on medium and larger.d-none d-md-block [OK]d-none plus breakpoint d-*-block to show [OK]d-block d-md-none which hides on medium screenssm and md breakpoints<div class="invisible">Hello</div>
invisible class effectinvisible class applies visibility: hidden;, hiding the content but keeping its space.invisible hides content but keeps layout space [OK]invisible hides text but keeps space [OK]invisible removes element from layoutinvisible with d-noned-none d-sm-blockd-none hides element on all sizes, d-sm-block shows it from small screens up, so it remains hidden on extra small but visible on small and larger.d-none d-md-block [OK]d-sm-block instead of d-md-blockd-none can be overridden by smaller breakpointd-none d-md-block sets display: none by default (hides completely on xs/sm), then display: block from md up (visible on md+).d-md-visible. D uses invisible which applies visibility: hidden everywhere, so remains hidden even on md+.d-none d-md-block [OK]d-none d-md-block to hide below medium, show from medium [OK]invisible which keeps space but stays hidden on large screensd-md-visiblePass the test and this pattern moves unknown