MotivationInstallDocsCustomize
MotivationInstallDocsCustomize
  • Overview
  • Important! Purge!
  • Getting Started
    • Colors and Pseudo Classes
      • Colors
        • Color Shades

        • Psuedo Classes

      • Classes with Colors
        • Text Color

        • Background Color

        • Border Color

        • Outline Color

        • Text Decoration

        • Selection

      • Transitions
        • Transition Classes

        • With Pseudo Classes

      • Additional Classes
        • Font Size

        • Font Family

        • Font Weight

        • Text Decoration & Style

        • Border Width & Style

        • Outline Width & Style

    • Dark Mode
      • With JS

      • No JS

      • Grid
        • Class Definitions

        • Responsive Examples

        • Responsive Examples
          • Breakpoints

          • Max Breakpoints

          • Examples

          • Margin
            • Classes

            • Examples

          • Padding
            • Classes

            • Examples

          • Border Width
            • Classes

            • Examples

          • Outline Width
            • Classes

            • Outline Offset

            • Examples

          • Width
            • Rem Values

            • Percantage Values

            • Screen relative Values

            • XS - XL

          • Height
            • Rem Values

            • Percantage Values

            • Screen relative Values

            • XS - XL

          • Display
          • Flex
            • Flex Direction

            • Flex Wrap

            • Shrink & Grow

            • Justify Content

            • Align Content

            • Align Items

            • Align Self

            • Not Included

          • Text/Font
            • Font Size

            • Line Height

            • Letter Spacing

          • Position
            • Top Left Right & Bottom

          • Overflow
            • Overflow x & y

          • Box Sizing
        • Box-Shadow
          • Size

          • Color

          • Respoinsive

          • Psuedo States

          • Other Utilities
            • Text/Font
              • Align

              • Transform

              • Indent

              • Wrap

              • Font Family

              • Font Weight

              • Font Style

              • Text Decoration

              • Decoration Thickness

            • Border
              • Directional Style

            • Outline Style
            • Cursor
            • Opacity
            • Visibility
            • z-Index

          Simple Scss Utilities


          Padding

          How to use

          Padding is very similar to margin. They can have sm, md, lg, xl etc. classes, they also have the same fractional classes, they can be applied in any direction, they both cna be made responsive, adn indeed modifying the same values in variables.scss will apply classes to both.

          Classes

          Here are the default classes. Like with margin that in addition to the p-[size] classes, there's also .pt,.pb,pl, and pr classes for top, bottom, left, and right paddings respectively, as well as .px and .py classes for both left and right or top and bottom.

          All these clases also respond to the responsive prefixes, see the (Responsive)[/docs/responsive-classes/] section for details for that as well.

          Note that the percents aren't repeated, for example, there's a 1/20 padding but not a 2/20 padding or a 4/20 padding because those are already handled by the 1/10 and 1/5 classes.

          Note that with the fraction classes the percents aren't repeated, for example, there's a 1/20 and a 3/20 padding, but not a 2/20 padding or a 4/20 padding because those are already handled by the 1/10 and 1/5 classes.

          ClassCSS rule
          .p-0padding: 0;
          .p-xxspadding: 0.125rem;
          .p-xspadding: 0.25rem;
          .p-smpadding: 0.5rem;
          .p-mdpadding: 0.75rem;
          .p-basepadding: 1rem;
          .p-lgpadding: 1.25rem;
          .p-xlpadding: 1.5rem;
          .p-2xlpadding: 2rem;
          .p-3xlpadding: 3rem;
          .p-4xlpadding: 4rem;
          .p-5xlpadding: 5rem;
          .p-1/2padding: 50%
          .p-1/3padding: 33%
          .p-2/3padding: 66%
          .p-1/4padding: 25%
          .p-2/4padding: 50%
          .p-3/4padding: 75%
          .p-1/5padding: 20%
          .p-2/5padding: 40%
          .p-3/5padding: 60%
          .p-4/5padding: 80%
          .p-1/10padding: 10%
          .p-3/10padding: 30%
          .p-7/10padding: 70%
          .p-9/10padding: 90%
          .p-1/20padding: 5%
          .p-3/20padding: 15%
          .p-7/20padding: 35%
          .p-9/20padding: 45%
          .p-11/20padding: 55%
          .p-13/20padding: 65%
          .p-17/20padding: 85%
          .p-19/20padding: 95%
          .p-fullpadding: 100%

          Each of these classes are repeated for top, bottom, left, right, x, and y directions so see some examples below:

          Examples

          Padding Sizes

          These are the example "default" sizes for paddings. Note these can all be changed by editing the _variables.scss file. See the Customize section for further info. Each blue box is a div, the light magenta areas represent the paddings applied by the classes in the caption:

          .pr-xs

          .pr-lg

          .pr-3xl

          .pr-sm

          .pr-xl

          .pr-4xl

          .pr-md

          .pr-2xl

          .pr-5xl

          Here's what the html for one of the boxes above would look like

          HTML
          <div className="mb-lg">
          <div className="bg-magenta-lt pr-xl radius-md">
          <div className="bg-blue w-3 h-3 radius-md" />
          </div>
          <p>.pr-xl</p>
          </div>

          Fractional Sizes

          Like margin, percents are relative to the containing element. With margins this makes more sense to me, and with padding I find this to be slightly more counter-intutitve but hey it's how it's done.

          Like with margin, for these examples I have a fixed witdth container, and a blue div element, but here the light magenta element signifies padding of the blue div's parent, but it's relative to the dashed-outline container div, so, like margin, it breaks out when given a width full (or near full):

          .pr-1/10

          .pr-1/5

          .pr-1/3

          .pr-1/2

          .pr-17/20

          .pr-full

          Here's an example for the HTML of the pl-1/2 box:

          HTML
          <div className="m-md">
          <div className="display-flex bg-background-dkr border-lg border-dark-mode-only-ltr border-dashed w-16">
          <div className="pr-1/2 bg-magenta-lt display-inline-block">
          <div className="bg-blue w-3 h-3" />
          </div>
          </div>
          <p>.pr-1/2</p>
          </div>

          Directional Paddings

          And here are examples of classes going in each direction. Each "directional" class also works for every one of the widths i.e. sm, md, lg, etc.

          .pt-xl

          .pr-xl

          .pt-xl

          .pb-xl

          .px-xl

          .py-xl

          A few examples of the above boxes (just pt, pb, and px):

          HTML
          <div class="display-flex flex-col justify-center ">
          <div class="display-flex center">
          <div class="bg-magenta-lt pt-xl radius-md">
          <div class="w-3 h-3 bg-blue radius-md"></div>
          </div>
          </div>
          <p>.pt-xl</p>
          </div>
          {" "}
          <div class="display-flex flex-col justify-center ">
          <div class="display-flex center">
          <div class="bg-magenta-lt pb-xl radius-md">
          <div class="w-3 h-3 bg-blue radius-md"></div>
          </div>
          </div>
          <p>.pb-xl</p>
          </div>
          <div class="display-flex flex-col justify-center ">
          <div class="display-flex center">
          <div class="bg-magenta-lt px-xl radius-md">
          <div class="w-3 h-3 bg-blue radius-md"></div>
          </div>
          </div>
          <p>.px-xl</p>
          </div>

          Responsive Paddings

          And finally, here's some examples with the responsive classes set. If you're on a browser, adjust the screen sizes to see them in action, although for small sizes you'll have to close the sidebar:

          .p-sm

          .tab:p-lg

          .scr:p-2xl

          .lg:p-3xl

          Code for the Box:

          HTML
          <div class="bg-background-dkr border-dark-mode-only-ltr border-lg border-dashed radius-md mb-md">
          <div class="w-5 h-5 m-sm tab:m-lg scr:m-2xl lg:m-3xl bg-blue radius-md" />
          </div>

          Responive padding with the max-[breakpoint] classes. Here the padding left is 1/4 for widths under 1024px and 3/4 for widths over that amount:

          .max-scr:pl-1/4

          .pl-3/4

          Happy coding!

          © 2025 Simple Scss Utilities