Implement a clever margin trick
This trick centers content and ensures a minimum margin of spacing size S. https://stackoverflow.com/questions/70323075/how-i-can-use-min-and-max-css-functions-to-work-with-auto
This commit is contained in:
parent
0ff918898b
commit
a8fd6e550f
2 changed files with 11 additions and 7 deletions
|
@ -20,16 +20,12 @@ body {
|
|||
}
|
||||
|
||||
main {
|
||||
margin-inline: auto;
|
||||
/* Center the content and ensure a minimum margin. The calculation in the
|
||||
* second argument does what `auto` would do if it could be used in max(). */
|
||||
margin-inline: max(var(--space-s), 50% - var(--content-width) / 2);
|
||||
max-width: var(--content-width);
|
||||
}
|
||||
|
||||
main,
|
||||
.site-header__conatiner,
|
||||
.site-footer__container {
|
||||
padding-inline: var(--space-xs);
|
||||
}
|
||||
|
||||
figure, img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
|
|
@ -12,3 +12,11 @@
|
|||
font-weight: normal;
|
||||
}
|
||||
}
|
||||
|
||||
.site-header__container,
|
||||
.site-footer__container {
|
||||
/* Center the content and ensure a minimum margin. The calculation in the
|
||||
* second argument does what `auto` would do if it could be used in max(). */
|
||||
margin-inline: max(var(--space-s), 50% - var(--content-width) / 2);
|
||||
max-width: var(--content-width);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue