Skip to content

Instantly share code, notes, and snippets.

@clausti
Last active January 18, 2020 02:34
Show Gist options
  • Save clausti/1b9978a5de7344df42b3da19760e7c58 to your computer and use it in GitHub Desktop.
Save clausti/1b9978a5de7344df42b3da19760e7c58 to your computer and use it in GitHub Desktop.
css grid align-items bug??
<div class='a-post-card-hack'>
<div class='cn-body'>I'm pretending to be a content note</div>
<div class='post-inner'>I'm pretending to be a post</div>
</div>
.a-post-card-hack {
display: grid;
.cn-body {
grid-column: 1; /* it can be just 1 or it can be 1/2, or it can be 1/-1 */
grid-row: 1/2; /* it appears not to matter as long as the divs are on top of one another */
display: grid; /* this way buggy */
display: flex; /* this way works */
align-items: center;
padding-top: 1.99rem; /* this div needs LESS TOTAL HEIGHT to break the vertical alignment */
padding-bottom: 2rem;
}
.post-inner {
grid-column: 1/-1;
grid-row: 1 ;
padding-top: 2rem;
padding-bottom: 2rem;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment