@import "colors.scss"; .post-item { padding: 3%; border-radius: 0.25rem; background: $base; h2 a { color: $fg; } div { /* Make the same value as in post-item's 3% padding. * 100 / 94 = ratio .post-item width / this div width, * 94 = 100% - (3% * 2), where * 3% is the padding in .post-item, * 3 * 2 = padding-left + padding-right = 3% + 3% */ margin-top: calc(3% * 100 / (100 - 3 * 2)); } }