Style Guide Code Snippets
When trying to include the following content into your side, please use the following guide to assist you with structuring and styling content on a page within the AODA Drupal Theme. Many of the recommended code snippets are from the Bootstrap Framework. Visit Bootstrap CSS for a full list of CSS classes. Please note that a majority of the following information requires a high level of technical understanding and general knowledge of web development.
Buttons
The following code snippets demonstrate the style classes you would use to style a button or a link so that it looks like a button. You can control the colour and size of each button. 
Button vs Link?
If clicking the button causes the user to go to a different page, use a link.
If clicking the button triggers a change on the page (but does not go to a different page), use a button.
Bootstrap Button Colours
Default / White

Primary / Blue

Success / Green

Info / Grey

Warning / Orange

Danger / Red

Bootstrap Button Sizes
Large

Small

Full Width

Expanding and Collapsing Buttons
The following code snippets demonstrates a button toggle that will show or hide the section of text below it. Replace 'uniqueNameForControl' with a unique name for the code snippet. Every time you use this snippet on a page, you will need to provide a different 'uniqueNameForControl' for that particular code snippet (eg. uniqueName1, uniqueName2, uniqueName3, etc.).
Images
Rounded Images
This demonstrates an image with rounded corners using the img-rounded class.

This demonstrates an image with rounded square corners and a border using the img-thumbnail class.

This demonstrates a circular image using the img-circle class.

Aligning Images
Centering Images
Avoid using <center> to center images on the page. Instead, use the "center-block" class.
Floating Images Left
Use the "pull-left" or "pull-right" classes to float images left or right.
Floating Images Right
Clearing Floated Images
To clear a float, you can put a "clearfix" class on the parent element.
Images with Captions
Use the following code to add a formatted caption to your image
Note: the img-rounded class is optional. The code above will provide the following effect:

By default, the border expands to fill available width in the area where the image has been placed. If you don't want that much white space on either side, you can either use a larger image or apply the pull-left or pull-right class to figure like so:
<figure class="thumbnail pull-right">
This will give you the following effect instead:

Creating a Responsive Image Grid with Bootstrap
2 Column Responsive Image Grid
Use the following code to create one row of a 2 column grid. Repeat for as many rows as you need. Remember to replace each img element with a decorative image that relates to the associated text link.

3 Column Responsive Image Grid
Use the following code to create one row of a 3 column grid. Repeat for as many rows as you need. Remember to replace each img element with a decorative image that relates to the associated text link.

4 Column Responsive Image Grid
Use the following code to create one row of a 4 column grid. Repeat for as many rows as you need. Remember to replace each img element with a decorative image that relates to the associated text link.
Image Overlay
Image Overlay with Single Heading Caption
The following code snippet demonstrates the method you would use to create a linked image with a clickable colour overlay. This overlay also features a caption when hovered over.
Make sure that the Text Format is switched to Full HTML rather than the default Filtered HTML.

The defualt overlay colour is black. To change this colour, input div class="img-overlay ug-gold"in place of div class="img-overlay" Colour options include: ug-gold ug red ug blue
If your desired alt text is the same as your caption text, you can choose to leave the alt text empty. Otherwise, alt text is required If your image was uploaded with text overlaying the image, alt text is also required.
Image Overlay with Two Captions
You can create a similar image overlay - but with additional text. This overlay will have a heading caption along the top of the image and a second, smaller caption along the bottom.
This can be done with any of the aforementioned colours.

Slideshows
The code below previously contained the code <div class="carousel-inner" role="listbox"> but now role="listbox" is removed so as to make the slideshow accessible. If you had the previous code please remove the role="listbox" from the code.
Use the following code to create an inline paginated slideshow.

Templates
Two Columned List
This code snippet demonstrates the method you would use to create a list with two columns.

Listing Text Content with a Left-Aligned Image
This code snippet demonstrates the method you would use to create a listing of content with a left-aligned image with text.
Notes:
Add more
<article class='row media'>tags to add new contentOnly need a single "media-listing-page" tag around all article tags
You may need to use "Full HTML" mode before entering this HTML code. Note that only site managers have access to this mode.

Headings that Expand and Collapse Sections
Start with content that has a heading, e.g.
To make the section collapsible, it needs to be wrapped in div tags like this:
After you've put the content in a div, give that div the class name collapse and a unique ID:
Now turn your section title into a link with the following code:
Note that href has to equal the unique ID of the div. This is so the link, when clicked, knows which div it's supposed to expand or collapse. So if you want multiple divs on the page that can be expanded or collapsed, each one must have a unique ID.
Note: If you want a section to be expanded by default when a page loads instead of hidden/collapsed, rewrite the link heading code as follows:
That is, remove the code class=collapsed (when you include class=collapsed, it makes the link show up with a "Plus" icon to indicate the content can be expanded. This "Plus" icon changes to a "Minus" when the content is expanded). You also need to change the section's div code from:
to:
Markup for complete, working example:
If you'd like to add a button that toggles multiple sections at the same time, you need to add one more class to each div. For this example, we'll call the class collapse-all though you can use whatever name you prefer:
The code for the button would look like this:
For aria-controls, list all the div IDs you want the button to control. For data-target, use the class collapse-all (or whatever name you chose - it just needs to be the same for each div). So the complete code would look something like this:
Equal Height Boxes
Note as of 10/20/2017: This will be available in the next release, v23.0

Code for the boxes is structured as follows:
Code for the box container is:
Code for an individual box is:
The bootstrap class col-md-4 means you'll have, if screen space permits, a maximum of 3 boxes in a row. The flex-col class ensures the button always appears under the list of items (as opposed to, say, floating right next to it). The well class is optional for getting the grey background and border effect.
The flex-grow class, applied to the list, pushes the button down to the bottom of the box (as opposed to right beneath the list). The list-narrow class is optional, meant for applying a smaller font size and shorter line heights (as opposed to how default body text looks).
Miscellaneous
Icons
Icon Only
We are currently using the FontAwesome icon library. To use the icons, make sure to put a non-breaking space between the tags, otherwise ckeditor will remove the icon code when you edit it. For Example:
Different icons may use a different set of classes (eg. "fab" for brand icons):

See the official documentation at: https://fontawesome.com/how-to-use/on-the-web/referencing-icons/basic-use
The cheatsheet of all the available icons is at: https://fontawesome.com/cheatsheet
Icon with Link Text/Text
How do I view all available icons, class names, character codes and aliases?
Font Awesome provides a cheatsheet page where all of that information can be found: http://fontawesome.io/cheatsheet/
How do I increase the size of my icon?
To increase icon sizes relative to their container, use the
fa-lg(33% increase),fa-2x,fa-3x,fa-4x, orfa-5xclasses.
Last updated
Was this helpful?