Bootstrap Shorthand Responsive Classes

At times I needed to completely change sections of the bootstrap template to fit my needs and page design. I learnt more about bootstrap classes and how to use them appropriately to adjust margins and padding. Some of these classes were already being used in the Bootstrap template, however I did not understand their purpose.

When researching further I discovered that the classes were shorthand for built in CSS. 

The classes are named using the format {property}{sides}-{size} for xs and {property}{sides}-{breakpoint}-{size} for sm, md, lg, and xl.

Therefore as an example, using the class 'ml-1' equates to margin left (ml) with the spacer variable multiplied by 0.25.



There was also similar shorthand classes for the display properties where by d-none d-block (display: block) displayed the element for extra small screen sizes only. Without a breakpoint Bootstrap automatically assumes that the breakpoint is for xl screens however, if this breakpoint was added e.g. d-none d-xl-block this element would only be displayed for extra large screen sizes.

Notation:

d-{value} for xs
d-{breakpoint}-{value} for sm, md, lg, and xl.

These classes allowed me to hide particular elements, which I used specifically for when the website needed to be responsive for mobile. When the page width is reduced in size to mobile, the header body image disappears from view, leaving the logo and header copy. This was achieve using the in-built display classes.


BOOTSTRAP. (n.d.). Bootstrap Display property. [Online] Available at: https://getbootstrap.com/docs/4.0/utilities/display/
BOOTSTRAP. (n.d.). Spacing. [Online] Available at: https://getbootstrap.com/docs/4.0/utilities/spacing/

Popular posts from this blog

Handmaids Tale Experimentation

Platform Considerations

Showreel