Common Classes

Foundry leverages Bootstrap for many of its structural elements under the hood. This means you not only get the world's most powerful framework as your site's starting point, but you get access to a lot of additional CSS classes to help you fine tune your pages.

While you can use Foundry's Blacksmith tool to build out your own custom classes and other selectors to tweak your page designs, you also have access to many CSS classes that come baked into Bootstrap. Below we'll outline some of the most common classes you might want to use to tweak your page elements.

We named the dog Indiana.

While we've listed a few of the most common classes you might use for tweaking your page elements, there is a whole world of other classes in Bootstrap. Not all will apply to you or Foundry, but you can find them in the Bootstrap documentation if you'd like to explore further.

How To Use These CSS Classes

Almost every tool within Foundry contains a setting at the bottom of the settings palette that allows you to add custom class names. This allows you to take these tools beyond what they can already do. Below you'll find examples of many of the in-built CSS classes in Bootstrap that you can leverage by adding them to this field in the Foundry tools.

Spacing

Allows you to apply preset amounts of padding and / or margin around an element. This works a bit like using the Spacing tool's preset functionality.

Basics

The spacing classes are powerful, and can be applied to ranges of breakpoints depending on how you form your class names.

To apply spacing to the Extra Small breakpoint and up we contstruct the class name like so:

[ Property Type ][ Side ]-[ Preset Size ]

If we'd like to target specific breakpoints we can use this format for our class names:

[ Property Type ][ Side ]-[ Breakpoint ]-[ Preset Size ]

Property Type

For the Property Type we choose one of the following, depending if we want to apply margin or padding:

  • m - To apply Margin
  • p - To apply Padding
Side

For the Side we can choose one, multiple, or all. This will determine which sides of our element the spacing will be applied to:

  • t - Top
  • b - Bottom
  • s - Start (left)
  • e - End (right)
  • y - Both Top and Bottom
  • x - Both Start (left) and End (right)
  • blank - Spacing is applied to all sides
Breakpoint

Here we can specify at which breakpoints we'd like to apply our spacing. We can choose from Foundry's six breakpoints:

  • blank - Extra Small breakpoint and larger
  • sm - Small breakpoint and larger
  • md - Medium breakpoint and larger
  • lg - Large breakpoint and larger
  • xl - Extra Large breakpoint and larger
  • xxl - Extra Extra Large breakpoint and larger
Size

Here we can specify which of the 5 presets we want to use for our spacing, or choose zero for no spacing:

  • 0 - No spacing
  • 1 - Preset 1
  • 2 - Preset 2
  • 3 - Preset 3
  • 4 - Preset 4
  • 5 - Preset 5
Examples

If we'd like to apply padding to all sides of an element, at all breakpoints using Preset spacing #5 our class name would look like this: p-5

If we'd like to apply margin to the top and bottom of an element, at the large breakpoint and larger using Preset spacing #3 our class name would look like this: my-lg-3

Display

Using the premade display classes we can show and hide content, on our page, among other things. We can do so across all breakpoints, or target a range of breakpoints.

Basics

To apply a display property to the Extra Small breakpoint and up we contstruct the class name like so:

d-[ Display Type ]

If we'd like to target specific breakpoint ranges we can use this format for our class names:

d-[ Breakpoint ]-[ Display Type ]

Display Type

Here we can specify which of the various display types we want to apply to our page element. We've listed them in order from most to least commonly to be used:

  • block - Displays as a block element. It starts on a new line, and takes up the whole width.
  • none - The element is not displayed.
  • inline - Displays as an inline element.
  • inline-block - A combination of inline and block display properties.

Bootstrap provides several more display property type. These can be found in the Bootstrap documentation if you're interested.

Breakpoint

Here we can specify at which breakpoints we'd like to apply our display property. We can choose from Foundry's six breakpoints:

  • blank - Extra Small breakpoint and larger
  • sm - Small breakpoint and larger
  • md - Medium breakpoint and larger
  • lg - Large breakpoint and larger
  • xl - Extra Large breakpoint and larger
  • xxl - Extra Extra Large breakpoint and larger
Examples

If we'd like to apply a block display property to an element at all fo the Foundry breakpoints we can apply the following class name: d-block

If we'd like to hide a page element, using none, at the large breakpoint and larger we could use the following: d-lg-none

Overflow

Sometimes we want to keep content from overflowing the bounds of an element, or just the opposite we'd like to allow it to do so. These are used most often with elements that have a fixed height and / or width. We can do that a more using the preset overflow classes in Bootstrap.

Basics

To apply an overflow property via a class name to our element we construct it like so:

overflow-[ Overflow Type ]

Overflow Types

We have three options to choose from for applying overflow properties to our page elements:

  • visible -Content that exceeds the bounds of our containing element will be visible.
  • hidden -Content that exceeds the bounds of our containing element will be hidden.
  • scroll -Content that exceeds the bounds of our containing element will be hidden, but can be accessed via a scroll bar that is added to the element.
Examples

If we'd like to apply an overflow property to our page element that allows the content to exceed the elements bounds we could use the following class name: overflow-visible

Borders

Often we'd like to add a simple border to an element, or between columns. If it doesn't need to be a complex border we can use one of Foundry's common CSS classes to accomplish this.

Basics

We can add a border to the outside of an element on all sides, or we can choose one or more sides to add a border to individually. Below we look at our options (these do not set a color or width of their own).

border

This class name will add a border to all four sides of a page element.

border-top

This class name will add a border to the top edge of a page element.

border-bottom

This class name will add a border to the bottom edge of a page element.

border-start

This class name will add a border to the left edge (start) of a page element.

border-end

This class name will add a border to the right edge (end) of a page element.

Exclusion

We can work backwards as well, adding a border to all four sides using the border class and then using one or more of the classes below to disable borders on specified side(s).

border-top-0

Removes the border on the top edge of a page element.

border-bottom-0

Removes the border on the bottom edge of a page element.

border-start-0

Removes the border on the left edge (start) of a page element.

border-end-0

Removes the border on the right edge (end) of a page element.

An example of doing this would look like this: border border-top-0

This would put a border on three sides — left, right and bottom — while hiding the border on the top of our page element.

Use Color Presets

We also have access to Foundry's main 6 color presets for the border as well using the following class names:

  • border-primary - Applies the Primary color pallete color to the border.
  • border-secondary - Applies the Secondary color pallete color to the border.
  • border-success - Applies the Success color pallete color to the border.
  • border-danger - Applies the Danger color pallete color to the border.
  • border-warning - Applies the Warning color pallete color to the border.
  • border-info - Applies the Info color pallete color to the border.

Font Sizing

We can customize out font size using a few preset classes. Sometimes we'd like some text to be the size of a Heading for instance, but don't want it to use a header tag (h1, h2, h3, etc). We can accomplish that with the classes below. Each will size text to match Bootstrap's preset header sizes accordingly.

  • h1 - Sizes text to match Bootstrap's default H1 tag without using an actual header tag.
  • h2 - Sizes text to match Bootstrap's default H2 tag without using an actual header tag.
  • h3 - Sizes text to match Bootstrap's default H3 tag without using an actual header tag.
  • h4 - Sizes text to match Bootstrap's default H4 tag without using an actual header tag.
  • h5 - Sizes text to match Bootstrap's default H5 tag without using an actual header tag.
  • h6 - Sizes text to match Bootstrap's default H6 tag without using an actual header tag.

Additionally Bootstrap includes Display font classes that allow us to supersize text. We can use the classes below to apply these Display Font Sizes to our content. As a bonus these classes are responsive and will size down the text based on breakpoint as well.

  • display-1
  • display-2
  • display-3
  • display-4
  • display-5
  • display-6

Color

Most Foundry tools that deal with text have controls that allow you to interface with it to change the color, using the Foundry Presets, Custom Color Pickers, the Extended Palette, etc. Sometimes though you may want to access the Foundry Preset Color Palette using quick class names. Below you'll find class names for setting the Color of a page element:

  • text-primary - Applies the Primary color pallete color to the text in a page element.
  • text-secondary - Applies the Secondary color pallete color to the text in a page element.
  • text-success - Applies the Success color pallete color to the text in a page element.
  • text-danger - Applies the Danger color pallete color to the text in a page element.
  • text-warning - Applies the Warning color pallete color to the text in a page element.
  • text-info - Applies the Info color pallete color to the text in a page element.

Background Color

If you're looking for a quick and easy way to apply a background color to a pager element using one of Foundry 6 Preset Colors, you can apply one of these classes to that page element:

  • bg-primary - Applies the Primary color pallete color to the background of a page element.
  • bg-secondary - Applies the Secondary color pallete color to the background of a page element.
  • bg-success - Applies the Success color pallete color to the background of a page element.
  • bg-danger - Applies the Danger color pallete color to the background of a page element.
  • bg-warning - Applies the Warning color pallete color to the background of a page element.
  • bg-info - Applies the Info color pallete color to the background of a page element.

Opacity

We can easily change the opacity of a page element, and all of the items within that element, by applying one of the preset opacity class names below:

  • opacity-25 - Sets the opacity to 25%
  • opacity-50 - Sets the opacity to 50%
  • opacity-75 - Sets the opacity to 75%
  • opacity-100 - Sets the opacity to 100%

  • opacity-0 - Sets the opacity to 0%

Horizontal Stacking

Basics

We can stack elements together horizontally by applying a class to a containing element. In Foundry 3 we often use the Container for things such as this. Using the class hstack on a containing element we'll get horizontally stacked items. Here's a quick example using a Container with some buttons inside, where we've applied the class hstack to the Container:

Spacing

In the above example we've also applied the class gap-1 to add spacing between the buttons. You can use these preset gap class names to apply different amounts of spacing:

  • gap-1
  • gap-2
  • gap-3
  • gap-4
  • gap-5