Primer CSS Spacing
Primer CSS is a free open-source CSS framework that is built with the GitHub design system to provide support to the broad spectrum of Github websites. It creates the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, and BEM architecture. It is a highly reusable model.
Primer CSS Spacing can be utilized to provide the indentation around the element by implementing the defined classes i.e. it is used to provide the spacing within the components such as buttons, form elements, etc. It is primarily used to achieve a bigger vertical as well as horizontal spacing between the sections.
Primer CSS Spacing Components:
- Spacing scale: It is a predefined range of values that is used to specify the amount of the utilities like margin, padding, etc. It is used in Primer CSS is a base-8 scale, using it is extremely flexible because we can multiply or divide the eight as many times as we want and we will end up with whole numbers.
- Extended spacing scale: It adds six more options to the existing spacing scale. That means the scale which had the range of 0-6 is now increased to 7-12. But this extended range doesn’t work for every utility class in every direction. We can use extended class is in margin and padding. The extended range i.e., 7-12 doesn’t work on the x-axis but does work on the left and right sides individually for margin and padding. But for margin, we cannot use that 7-12 range for the complete x-axis neither together nor individually. Unlike the Basic Scaling Scale in the Extended part, the value increases by 16px instead of 8px.
- Em-based spacing: It is mainly used to provide the spacing between the components, having the values in em, for which the value combined with typography, line-height, or the total height becomes sensible numbers.
<div class="Primer-CSS-SpacingClasses"> ... </div>
We can provide spacing around the element in 2 ways, i.e. by using the padding & margin that will create space around the elements.
Please refer to the Primer CSS Padding & Primer CSS Margin articles for a detailed description.
Example 1: This example describes the Primer CSS Spacing by demonstrating the uniform padding utilities using the required classes in it.
Example 2: This example describes the Primer CSS Spacing by demonstrating the uniform margin utilities using the required classes in it.
Please Login to comment...