Skip to content

Instantly share code, notes, and snippets.

@spin0us
spin0us / details-summary-display-hack.md
Last active July 28, 2023 08:42
Details html element hack to overcome the impossibility to change its display style

I was trying to apply a display:grid on a details element for a project, but it fails. After some search, it's seems to be impossible to change the display style of this element. Only solution is to simulate this element with new custom element and some javascript. Here is the result.

Here is the CSS part

custom-details > custom-summary {
    cursor: pointer;
    display: list-item;
    list-style-position: inside;
 list-style-type: disclosure-closed;