freecoding.school100% FREE · NO SIGNUP
Grid CanyonISSUE #2 of 27

display · none · contents · table-*

FlexboVSThe Float Phantom
Flexbo saysdisplay:none removes an element entirely; display:contents drops the box but keeps its children.

display:none takes an element out of layout and the accessibility tree. display:contents removes the box itself but promotes its children into the parent's layout — useful with flex/grid wrappers. There are also table display values for legacy layout mimicry.

Power-ups you unlock

The Float Phantom attacks — common mistakes

Boss battleToggle an element between display:none and block, then try display:contents on a flex wrapper.

Example code

<!doctype html><html><head><meta charset="utf-8">
<style>.gone{display:none}</style></head><body style="background:#06040d;color:#e6e0ff;padding:20px"><p>visible</p><p class="gone">removed</p><p>also visible</p></body></html>
▶ Open the interactive comic issue
‹ Display · Block · Inline · Inline-BlockPosition · Static · Relative · Absolute · Fixed · Sticky ›