My pattern library

12.1 #Positioning.__after-only-child-center-below `::after` centered below element's only child

Toggle example guides Toggle HTML markup

Note: The reason why a nested element is needed is that I want to be able to expand the ::after element to the whole length of its generating element. But this is not possible unless I use width: -webkit-fill-available;, which I don't want. Therefore, my solution is to wrap the actual element in a ad-hoc parent which the actual element determines the width of. The ::after element can then be styled with width: border-box; to make it extend to the width of the parent of its generating element, i.e. the width of its generating element.

Example
Lorem ipsum dolor sit amet
Markup
<style>
.__after-only-child-center-below > *::after {
  width: 1em;
  height: 1em;
  background-color: black;
}
</style>
<div class="__after-only-child-center-below">
  <div>
    Lorem ipsum dolor sit amet
  </div>
</div>
Source: css/modules/positioning/pseudo.css, line 1