I am struggling with adding a margin to each of the children in my nested <details>
elements
.container {
margin: 20px;
}
.parent,
.child {
outline: none;
border: none;
user-select: none;
cursor: pointer;
}
<div class="container">
<details class="parent">
<summary class="parent">parent summary</summary>
<details class="child">
<summary class="child">child summary</summary>child</details>
<details class="child">
<summary class="child">child summary</summary>child</details>
<details class="child">
<summary class="child">child summary</summary>child</details>
<details class="child">
<summary class="child">child summary</summary>child</details>
</details>
</div>
In my attempts, I added margin-left: 20px
to the .child
class. While it worked in codepen, in Chrome, the elements appeared in a straight column instead.
Is there a simple solution that I may have overlooked?