--- name: bootstrap-helpers description: This skill should be used when the user asks about Bootstrap helpers, Bootstrap clearfix, Bootstrap color and background helpers, Bootstrap colored links, Bootstrap focus ring, Bootstrap icon link, Bootstrap position helpers, Bootstrap ratio helpers, Bootstrap stacks, Bootstrap stretched link, Bootstrap text truncation, Bootstrap vertical rule, Bootstrap visually hidden, or needs help with Bootstrap helper classes. --- # Bootstrap 5.3 Helpers Bootstrap provides helper classes for common utility patterns that extend the base utility classes. ## Clearfix Clear floats within a container: ```html
``` ## Color & Background Combined color and background helpers for proper contrast: ```html
Primary with proper contrast
Secondary
Success
Danger
Warning
Info
Light
Dark
``` These ensure proper text color contrast automatically. ## Colored Links Link colors with hover states: ```html Primary link Secondary link Success link Danger link Warning link Info link Light link Dark link Body emphasis link 10% opacity 25% opacity 50% opacity 75% opacity 100% opacity Base underline with 50% opacity Primary underline at 25% No underline Light underline Offset underline More offset ``` ### Hover Variants Link utilities include hover variants for dynamic effects: ```html Brightens on hover Underline on hover Offset increases on hover Underline appears on hover ``` ## Focus Ring Custom focus ring styling: ```html Custom focus ring Primary Secondary Success Danger Custom color ``` ## Icon Link Style links that include icons: ```html Icon link Icon link Icon link Icon link ``` ## Position Position helpers for common patterns: ### Fixed Position ```html
Fixed to top
Fixed to bottom
``` ### Sticky Position ```html
Sticky top
Sticky top on sm+
Sticky top on md+
Sticky top on lg+
Sticky top on xl+
Sticky top on xxl+
Sticky bottom
Sticky bottom on sm+
Sticky bottom on md+
Sticky bottom on lg+
Sticky bottom on xl+
Sticky bottom on xxl+
``` ## Ratio Maintain aspect ratios for embeds and videos: ```html
``` ## Stacks Quick flexbox layouts: ### Vertical Stack (vstack) ```html
First item
Second item
Third item
``` ### Horizontal Stack (hstack) ```html
First
Second
Third
``` **Browser Support Note:** Gap utilities (`.gap-*`) with flexbox aren't fully supported in Safari versions prior to 14.5. Grid layout is unaffected. For broader browser support, consider using margin utilities instead. ## Stretched Link Make entire container clickable: ```html
...
Card with stretched link

Some text that will appear.

Go somewhere
...
Columns with stretched link
Go somewhere
``` **Note:** The parent must have `position: relative` (cards have this by default). **Identifying the containing block:** If the stretched link doesn't work as expected, check for these CSS properties on parent elements which also create containing blocks: `transform`, `perspective`, `filter` (Firefox only), or `will-change` set to `transform` or `perspective`. ## Text Truncation Truncate long text with ellipsis: ```html
This text is too long and will be truncated with an ellipsis.
This text is truncated. ``` ## Vertical Rule Vertical dividers: ```html
Item 1
Item 2
Item 3
``` ## Visually Hidden Hide content visually but keep accessible to screen readers: ```html

Title for screen readers

Skip to main content ``` **Use cases:** - Skip navigation links - Form labels when visual context is sufficient - Additional context for icons/images - Headings for document structure **Sass mixins** available for custom classes: ```scss @import "bootstrap/scss/mixins/visually-hidden"; .custom-sr-only { @include visually-hidden; } ``` ## Sass Customization Many helpers support build-time customization via Sass variables: - **Focus Ring**: `$focus-ring-width`, `$focus-ring-opacity`, `$focus-ring-blur` - **Icon Link**: `$icon-link-gap`, `$icon-link-icon-size`, `$icon-link-icon-transform` - **Ratio**: `$aspect-ratios` map for custom aspect ratios ## Additional Resources ### Reference Files - `references/helpers-reference.md` - Complete helper class reference and Sass customization options ### Example Files - `examples/accessibility-patterns.html` - Visually hidden, focus ring, skip links, and screen reader utilities - `examples/link-helpers-patterns.html` - Colored links, icon links, stretched links, and link utilities - `examples/position-layout-patterns.html` - Fixed and sticky positioning patterns - `examples/ratio-embed-patterns.html` - Responsive video embeds and aspect ratio utilities - `examples/stack-patterns.html` - Comprehensive vstack/hstack patterns including gap variations