diff --git a/app/assets/stylesheets/desktop/topic-post.scss b/app/assets/stylesheets/desktop/topic-post.scss index 061083b3746..47430151684 100644 --- a/app/assets/stylesheets/desktop/topic-post.scss +++ b/app/assets/stylesheets/desktop/topic-post.scss @@ -670,18 +670,23 @@ blockquote { margin-right: 0; padding: 12px; a.mention {background: darken(scale-color-diff(), 10%);} - p:first-of-type {margin-top: 0;} - p:last-of-type {margin-bottom: 0;} - h1:first-of-type, h2:first-of-type, h3:first-of-type { margin-top: 0;} } +// we assume blockquotes have their own margins, so all blockquotes +// will remove margins from first (top) and last (bottom) child elements +blockquote > *:first-child { + margin-top: 0; +} +blockquote > *:last-child { + margin-bottom: 0; +} + + /* quotes with attribution */ .quote { &>blockquote { margin-top: 0; padding-top: 0; - p:first-of-type {margin:0;} - h1:first-of-type, h2:first-of-type, h3:first-of-type { margin-top: 0;} .onebox-result { background-color: scale-color-diff(); } @@ -691,8 +696,8 @@ blockquote { border-left: 5px solid darken(scale-color-diff(), 10%); background-color: scale-color-diff(); padding: 12px; - .avatar { margin-right: 7px; } - img { margin-top: -4px; } + .avatar { margin-right: 7px; } + img { margin-top: -4px; } } aside { diff --git a/app/assets/stylesheets/mobile/topic-post.scss b/app/assets/stylesheets/mobile/topic-post.scss index 3fb19ac7e3f..5491019aa57 100644 --- a/app/assets/stylesheets/mobile/topic-post.scss +++ b/app/assets/stylesheets/mobile/topic-post.scss @@ -479,6 +479,15 @@ blockquote { margin-right: 0; } +// we assume blockquotes have their own margins, so all blockquotes +// will remove margins from first (top) and last (bottom) child elements +blockquote > *:first-child { + margin-top: 0; +} +blockquote > *:last-child { + margin-bottom: 0; +} + .quote-controls { float: right; color: $primary;