Skip to content

Instantly share code, notes, and snippets.

@mgol
Created January 18, 2019 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgol/b69c19475d16544978d87c745c044dcc to your computer and use it in GitHub Desktop.
Save mgol/b69c19475d16544978d87c745c044dcc to your computer and use it in GitHub Desktop.
Safari bug with CSS Grid, display: contents & ::before/::after
<div class="grid">
<div class="replaced"></div>
<span class="green"></span>
<span class="red"></span>
</div>
.grid {
display: grid;
grid-template-columns: repeat(4, 150px);
}
.replaced {
display: contents;
}
.replaced::before, .replaced::after, .green, .red {
content: "";
width: 100px;
height: 100px;
}
.replaced::before, .green {
background-color: green;
}
.replaced::after, .red {
background-color: red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment