Display:contents; now supported in Chrome

Chrome now has support for display:contents;

It looks like it was released on March 5, in version 65.

display: contents causes an element’s children to appear as if they were direct children of the element’s parent, ignoring the element itself. This can be useful when a wrapper element should be ignored when using CSS grid or similar layout techniques.

A few months ago I found myself in a situation where an extra wrapping div was needed in a flexbox layout for desktops. However, on mobiles the extra div needed to be removed to change the display order. The answer to the problem was display:contents;

It’s good to know that it is supported in Chrome and Firefox now, hopefully that will put some pressure on Edge to get caught up. :slight_smile:

Click on the HTML or CSS button below and it will change the layout width, then you will see the media query kick in.

4 Likes

Hooray my demo from 2 years ago now works in Chrome:)

(Who needs grid layout :))

4 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.