Is there any rule for the sizing values used in Bootstrap SCSS? #40898
-
I often see in SCSS files that sizing values such as padding-top: 1.25rem and margin: 0.75rem etc. are commonly used. Should I always follow the rule of using increments of 0.25, or can I use any value like padding: 0.19rem? Is there a resource that explains such guidelines? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I'm not sure if there are explicit rules documented somewhere, but it’s primarily tied to the spacing scale you're using. Common values like |
Beta Was this translation helpful? Give feedback.
I'm not sure if there are explicit rules documented somewhere, but it’s primarily tied to the spacing scale you're using. Common values like
0.25rem
,0.75rem
, and1.25rem
are based on a16px
font size base, so, for instance,0.25 * 16
gives you4px
. If you use something like0.19rem
, that would equal3.04px
, which isn’t ideal because non-integer pixel values can lead to inconsistencies or rounding issues in rendering.On top of that, the choice between using
rem
,px
, orem
can also depend on how you want the layout to behave when users zoom in or out. It depends on the use cases and renderings.