Skip to Main Content

Using Bootstrap in LibGuides

LibGuides is built upon Bootstrap, a framework of CSS, JavaScript, and HTML. Librarians can increase the usability and functionality of their guides with Bootstrap’s components without the need of extensive web development experience.

Authored by

Robert "Bob" Smith

Bob originally created this guide. The goal was to assist librarians in utilizing Bootstrap within LibGuides.

As of Feb. 2nd, 2024, Bob has left the employ of West Texas A&M University.

Color Accessibility Overview

Many of the components discussed within this LibGuide use color. With the use of color, accessibility needs to be a concern. As such, you'll need to know Bootstrap's (as utilized by SpringShare) current contrast issues and potential fixes prior to using some of the color-based styling within Bootstrap.

Color Communicating Meaning

1.4.1. Use of Color: Color is not used as the only visual means of conveying information, indicating an action, prompting a response, or distinguishing a visual element.
WCAG 2.0

In an instance where meaning is only communicated using color, you may need to add a <span class="sr-only"></span> to communicate the meaning the color was intended to communicate. The class sr-only hides content from visual users while keeping it available for screen readers.

For further information for this WCAG 2.0 requirement, please check-out W3C's Use of Color: Understanding SC 1.4.1

Color Contrast

The other accessibility consideration concerning the use of color is contrast. Simply put, the font color most contrast enough with the background color that low vision users may read the text.

WCAG 2.0 establishes the required contrast level for small and large fonts. Large fonts are considered to be 18.5px and bold or just bigger than 24px. The following table describes the contrast ratio requirement for AA and AAA WCAG 2.0 compliance:

  Normal Text Large Text
AA 4.5:1 3:1
AAA 7:1 4.5:1

When talking about Bootstrap coloring in terms of contrast, I will be using the terms "Full AA Compliance" and "Full AAA Compliance." With these terms, I am saying that no matter if the element is considered normal or large text, the colors will meet AA or AAA requirements. In order to keep things simple, any CSS suggestions for Bootstrap components will meet the level as indicated for normal and large texts.

Important Resources Concerning Contrast

W3C: Technique G18
Helps explain the contrast rules and how to ensure compliance.

CSS for Accessibility

The following sections provide CSS edits based on the WCAG 2.0 Levels for foreground and backgroung color. This is not an exhaustive list and by no means am I gauranteeing a fully accessible LibGuide. It is essential that you test your guides against accessibility standards.

.navbar-default .navbar-brand,.navbar-default .navbar-nav>li>a{color: #666666}











.navbar-default .navbar-brand,.navbar-default .navbar-nav>li>a{color:#4A4A4A}

.navbar-brand:focus, .navbar-default .navbar-brand:hover,.navbar-default .navbar-nav>li>a:hover,navbar-default .navbar-nav>li>a:focus{color:#595959;background-color:#fff}






.text-muted,blockquote footer, blockquote small,.h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small,.s-lg-text-ghost,.s-lg-rss-date,.h1 .small, .h1 small, .h2 .small, .h2 small, .h3 .small, .h3 small, .h4 .small, .h4 small, .h5 .small, .h5 small, .h6 .small, .h6 small, h1 .small, h1 small, h2 .small, h2 small, h3 .small, h3 small, h4 .small, h4 small, h5 .small, h5 small, h6 .small, h6 small{color:#595959}














Inserting CSS into All Guides

To insert the CSS above, do the following:

  1. Copy the CSS of the Level you wish to achieve
  2. Click "Look & Feel" from the "Admin" dropdown. If you don't see an "Admin" dropdown, you are not an admin and will need to talk to the individual (s) responisble for administering your guide.
  3. Click the tab named "Custom JS/CSS"
  4. Paste the CSS into the "JS/CSS Code" input area