Skip to content

::before and ::after pseudo-elements #247

Open
@runarberg

Description

@runarberg

I’ve noticed that Chrome does not render the ::before and ::after pseudo-elements. The spec doesn’t appear to specify whether they should or shouldn’t be supported. I would expect that most CSS features would be supported unless explicitly specified not to.

My use case was trying to implement something like the old <menclose notation="downdiagonalstrike"> with CSS:

<mrow class="cancel">
  <mn>1</mn><mo>+</mo><mn>1</mn>
</mrow>
.cancel {
  position: relative;
}

.cancel::after {
  background: linear-gradient(
    to bottom right,
    transparent calc(50% - 0.1ex),
    currentColor calc(50% - 0.05ex),
    currentColor calc(50% + 0.05ex),
    transparent calc(50% + 0.1ex)
  );
  content: "";
  inset: 0;
  position: absolute;
}

I could off course just add the background to the original element, but if the line is a different color than the content, then the line is drawn behind the content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions