CSS PADDING

In CSS, padding defines the space inside an element, between its content and its border.

details {
padding: 10px;
}
details {
padding-top: 10px;
padding-right: 15px;
padding-bottom: 10px;
padding-left: 15px;
}
details {
padding: 10px 15px;
}

  • Top & bottom: 10px
  • Left & right: 15px
details {
padding: 15px;
border: 1px solid #ccc;
border-radius: 8px;
}

You can control each side separately:

Or use the shorthand:

This means:

For a <details> element, for example:

Note: padding applies to the details element itself. If you want to add spacing specifically around the <summary> text or the expanded content, style summary or the content separately.

Comments