Last active
May 11, 2022 15:35
-
-
Save johnsfuller/967809f3304e0b83e6406e6c432814b2 to your computer and use it in GitHub Desktop.
A modern, mobile-first approach to HubSpot's layout.css file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* required css vars | |
* --site-width (site max-width) | |
* --site-gutter (site container padding) | |
* --site-spacing-y (site vertical rhythm) | |
* --hs-grid-gap-x (horizontal gap between dnd columns) | |
*/ | |
.dnd-section { | |
padding: 4em 0; | |
} | |
/* row-module class for full row modules that utilize the --site-gutter var */ | |
.dnd-section .row-module { | |
margin: 0 calc(var(--site-gutter) * -1); | |
} | |
.dnd-section > .row-fluid { | |
margin-left: auto; | |
margin-right: auto; | |
max-width: var(--site-width); | |
padding-left: var(--site-gutter); | |
padding-right: var(--site-gutter); | |
position: relative; | |
} | |
.dnd-section > .row-fluid .hs-private { | |
width: 100%; /* for the dnd add module here placeholder */ | |
} | |
@media (min-width: 768px) { | |
.dnd-section .row-fluid { | |
column-gap: var(--hs-grid-gap-x); | |
display: flex; | |
} | |
.dnd-section [class*='span'] { | |
flex: 1; | |
} | |
{% for i in range(0,13) %} | |
.dnd-section .span{{ i }} { | |
flex-basis: {{ i / 12 * 100 ~ '%' }}; | |
} | |
{% endfor %} | |
} | |
/* page editor */ | |
.hs-inline-edit .dnd-module { | |
min-height: 40px!important; | |
} |
Heads up if any of you use this... the visibility classes (.hide
, .show
, etc) are not included!
i would use the gap instead of column-gap .. https://caniuse.com/?search=gap
Yeah I definitely thought about it – but since gap
is shorthand for row-gap
& column-gap
and the hs dnd grid does not wrap (making row-gap
useless), I just included column-gap @adesignl
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Got any thoughts or questions? Comment below 👇 and/or follow me on Twitter @johnIsFuller