Gerillass

v2.1.0

After

Type: Mixin
@include after();

* You can call mixins with or without the gls- namespace (e.g. @include gls-after();).

The After Sass mixin helps you generate content or a style element after the actual content of the selected element or elements.

Arguments

NameTypeDescription
$contentstringYou can pass content as a string, or fetch a value using a custom property such as data-content.

When you want to fetch a value using a custom property, the name of the property must start with the 'data-' prefix. See the examples for more.

Examples

Simply pass a value as a string.

Sass
.element{
  @include after("Text to use!");
}
CSS
.element::after {
  content: "Text to use!";
}

You can target the ::after pseudo-element on its own and pass a declaration block.

Sass
.element{
  @include after{
    content: "Easy to use!";
    font-style: italic;
    color: red;
  };
}
CSS
.element::after {
  content: "Easy to use!";
  font-style: italic;
  color: red;
}

You can fetch a value using a custom property. One important thing to remember is that the name of the property must start with the 'data-' prefix.

HTML
<div class="element" data-currency="TL">200</div>
Sass
.element{
  @include after("data-currency");
}
CSS
.element::after {
  content: attr(data-currency);
}
Result

You can pass a value for the CSS content property as a string, and a declaration block between the opening and closing curly braces.

Sass
.element{
  @include after("data-currency"){
    font-size: .8em;
    color: red;
  };
}
CSS
.element::after {
  content: attr(data-currency);
  font-size: 0.8em;
  color: red;
}