diff options
authorWolfgang Müller2022-04-09 14:51:31 +0200
committerWolfgang Müller2022-04-09 14:51:31 +0200
commitca051ddec727780a69cf69afdd33eb9456c49d6b (patch)
parent01285fe6b24c1a012025067bd09a2af54fccda2b (diff)
sass: Always set margin-top for first <p> in <article>
Common elements in <article> usually have their own margin settings. In a previous CSS rule we make sure to set 'margin-top' for the first element in <article> to a lower value such that we have a consistent margin between the article header and the content itself. However, if the first element is not a <p>, no such margin change will take effect for the first <p> element. For example, if the first element is a floating <figure>, the <figure> element will have its margin modified, whilst the <p> will keep its usual settings, resulting in a very inconsistent layout. We assume that the first <p> element is at the top of the article in almost all cases, and include a new rule in this commit that applies the margin settings correctly.
1 files changed, 3 insertions, 0 deletions
diff --git a/sass/style.sass b/sass/style.sass
index 3c0ef83..69c0b1c 100644
--- a/sass/style.sass
+++ b/sass/style.sass
@@ -140,6 +140,9 @@ article >
> :first-child
margin-top: .5rem
+ > p:first-of-type
+ margin-top: .5rem
> p
line-height: 1.3