keyword

Contents — CSS reference

In the context of display, contents removes the ordinary wrapper box and lets its children participate in the surrounding box layout. The wrapper remains in the DOM; some unusual elements and accessibility mappings have special behavior. Do not use it to remove semantics or blindly flatten interactive controls.

Formal Syntax & Structure

css syntaxcss
display: contents;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>contents</title><style>body{margin:8px;font:16px/1.5 sans-serif}*{box-sizing:border-box}#parent{display:flex;gap:10px}#a{display:contents}#b,#c{width:70px;height:30px}</style><body><div id="parent"><div id="a"><span id="b">First</span><span id="c">Second</span></div></div></body></html>
CSS Reference