tommyosheawebdesign

Bricks Builder Typography and Spacing Framework

Nov 2nd, 2025
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 5.36 KB | None | 0 0
  1. /* ===========================================
  2.    FLUID TYPE & SPACING SYSTEM FOR BRICKS BUILDER
  3.    =========================================== */
  4.  
  5. :root {
  6.  
  7.   /* ===========================================
  8.      TEXT SIZE SCALE
  9.      =========================================== */
  10.   /* https://www.fluid-type-scale.com/calculate?minFontSize=16&minWidth=320&minRatio=1.125&maxFontSize=18&maxWidth=1280&maxRatio=1.2&steps=xs,s,m,l,xl&baseStep=m&prefix=text&decimals=2&useRems=on&remValue=16&previewFont=Inter */
  11.  
  12.   --text-xs: clamp(0.79rem, -0.01vw + 0.79rem, 0.78rem);
  13.   --text-s: clamp(0.89rem, 0.08vw + 0.87rem, 0.94rem);
  14.   --text-m: clamp(1rem, 0.21vw + 0.96rem, 1.13rem);
  15.   --text-l: clamp(1.13rem, 0.37vw + 1.05rem, 1.35rem);
  16.   --text-xl: clamp(1.27rem, 0.59vw + 1.15rem, 1.62rem);
  17.  
  18.   /* ===========================================
  19.      HEADING SIZE SCALE
  20.      =========================================== */
  21.   /* https://www.fluid-type-scale.com/calculate?minFontSize=20&minWidth=320&minRatio=1.25&maxFontSize=22&maxWidth=1280&maxRatio=1.333&steps=6,5,4,3,2,1,title&baseStep=4&prefix=h */
  22.  
  23.   --h6: clamp(0.8rem, -0.04vw + 0.81rem, 0.77rem);
  24.   --h5: clamp(1rem, 0.05vw + 0.99rem, 1.03rem);
  25.   --h4: clamp(1.25rem, 0.21vw + 1.21rem, 1.38rem);
  26.   --h3: clamp(1.56rem, 0.45vw + 1.47rem, 1.83rem);
  27.   --h2: clamp(1.95rem, 0.82vw + 1.79rem, 2.44rem);
  28.   --h1: clamp(2.44rem, 1.36vw + 2.17rem, 3.26rem);
  29.   --h-title: clamp(3.05rem, 2.15vw + 2.62rem, 4.34rem);
  30.  
  31.   /* ===========================================
  32.      GAP SCALE
  33.      =========================================== */
  34.   /* https://utopia.fyi/space/calculator?c=320,16,1.2,1280,18,1.25,5,2,&s= */
  35.   --gap-xxxs: clamp(0.25rem, 0.15rem + 0.52vw, 0.56rem);
  36.   --gap-xxs: clamp(0.5rem, 0.38rem + 0.63vw, 0.88rem);
  37.   --gap-xs: clamp(0.75rem, 0.63rem + 0.63vw, 1.13rem);
  38.   --gap-s: clamp(1rem, 0.77rem + 1.15vw, 1.69rem);
  39.   --gap-m: clamp(1.5rem, 1.25rem + 2.25vw, 3rem);
  40.   --gap-l: clamp(2rem, 1.54rem + 2.29vw, 3.38rem);
  41.   --gap-xl: clamp(3rem, 2.5rem + 2.5vw, 4.5rem);
  42.   --gap-xxl: clamp(4rem, 3.08rem + 4.58vw, 6.75rem);
  43.  
  44.   /* ===========================================
  45.      SECTION PADDING SCALE
  46.      =========================================== */
  47.   /* https://utopia.fyi/space/calculator?c=320,16,1.2,1280,40,1.25,5,2,&s= */
  48.   --section-xxxs: clamp(0.38rem, 0.08rem + 1.46vw, 1.25rem);
  49.   --section-xxs: clamp(0.75rem, 0.38rem + 1.88vw, 1.88rem);
  50.   --section-xs: clamp(1.13rem, 0.67rem + 2.29vw, 2.5rem);
  51.   --section-s: clamp(1.5rem, 0.75rem + 3.75vw, 3.75rem);
  52.   --section-m: clamp(2.25rem, 1.33rem + 4.58vw, 5rem);
  53.   --section-l: clamp(3rem, 1.5rem + 7.5vw, 7.5rem);
  54.   --section-xl: clamp(4.5rem, 2.67rem + 9.17vw, 10rem);
  55.  
  56.   /* ===========================================
  57.      CONTEXTUAL GAP VARIABLES
  58.      =========================================== */
  59.   --grid-gap: var(--gap-m);        /* Gap between columns */
  60.   --content-gap: var(--gap-s);     /* Gap between content elements */
  61.   --container-gap: var(--gap-m);   /* Gap between multiple containers in a section */
  62. }
  63.  
  64. /* ===========================================
  65.    TEXT SIZE UTILITY CLASSES
  66.    =========================================== */
  67.  
  68. .text-xl { font-size: var(--text-xl); line-height: 1.4; }
  69. .text-l  { font-size: var(--text-l);  line-height: 1.5; }
  70. body, .text-m { font-size: var(--text-m); line-height: 1.5; }
  71. .text-s  { font-size: var(--text-s); line-height: 1.6; }
  72. .text-xs { font-size: var(--text-xs); line-height: 1.7; }
  73.  
  74. /* ===========================================
  75.    HEADING SIZE UTILITY CLASSES
  76.    =========================================== */
  77.  
  78. .h-title { font-size: var(--h-title); line-height: 1.05; }
  79. h1, .h1  { font-size: var(--h1); line-height: 1.1; }
  80. h2, .h2  { font-size: var(--h2); line-height: 1.2; }
  81. h3, .h3  { font-size: var(--h3); line-height: 1.3; }
  82. h4, .h4  { font-size: var(--h4); line-height: 1.4; }
  83. h5, .h5  { font-size: var(--h5); line-height: 1.5; }
  84. h6, .h6  { font-size: var(--h6); line-height: 1.6; }
  85.  
  86. /* ===========================================
  87.    TYPOGRAPHY SPACING & RESET
  88.    =========================================== */
  89.  
  90. body :is(p, h1, h2, h3, h4, h5, h6, ul, ol, li) { margin: 0; }
  91. body :is(p, ul, ol) { margin-block-end: 1em; }
  92. body :is(p:last-of-type) { margin-block-end: 0; }
  93. body :is(h1, h2, h3, h4, h5, h6) { margin-block-end: 0.5em; }
  94.  
  95. body .brxe-text * + :is(h1, h2, h3, h4, h5, h6),
  96. body .brxe-post-content:not([data-source="bricks"]) * + :is(h1, h2, h3, h4, h5, h6) {
  97.   margin-block-start: 1em;
  98. }
  99.  
  100. body .brxe-text * + li,
  101. body .brxe-post-content:not([data-source="bricks"]) * + li {
  102.   margin-block-end: 0.5em;
  103. }
  104.  
  105. body .brxe-text * + :is(ul, ol),
  106. body .brxe-post-content:not([data-source="bricks"]) * + :is(ul, ol) {
  107.   padding-left: 16px;
  108.   margin-top: 0;
  109. }
  110.  
  111. /* Makes H2s within Rich Text and blog posts one size smaller */
  112. .brxe-text h2,
  113. .brxe-post-content h2 {
  114.   font-size: var(--h3);
  115. }
  116.  
  117. /* ===========================================
  118.    SPACING UTILITY CLASSES
  119.    =========================================== */
  120.  
  121. .grid-gap { gap: var(--grid-gap); }
  122. .content-gap { gap: var(--content-gap); }
  123. .content-gap-s { gap: calc(var(--content-gap) / 1.5); }
  124. .container-gap { gap: var(--container-gap); }
  125.  
  126. /* “Imperfect” fix for tighter heading/paragraph spacing */
  127. .content-gap :is(p, h1, h2, h3, h4, h5, h6),
  128. .content-gap-s :is(p, h1, h2, h3, h4, h5, h6) {
  129.   margin-block-end: -0.2em;
  130. }
  131.  
Advertisement
Add Comment
Please, Sign In to add comment