Grid displays with ol and ul lists in the WMS


OVERVIEW

Target audience: Site Administrators, Site Managers, Site Editors

The grid class in the Web Management System (WMS) can be applied to ordered and unordered lists to create grid-type displays.

In this article:

Overview

info

Note:

This article presumes some familiarity with basic HTML (ol and ul lists), applying CSS styles, and editing Source with the WYSIWYG Editor. To learn more about HTML tags and CSS classes used in the WMS, go to the Basic HTML markup in the WMS IT Knowledge Base article.

There are three kinds of lists (ordered, unordered, and definition) available in the WMS, the grid class applies only to ordered and unordered lists.

List type opening tagclosing tag
Ordered<ol></ol>
Unordered<ul></ul>
Definition<dl></dl>

For example, the HTML code for an ordered list with 6 list items would be something like:

 

<ol>
   <li>This is the first list item</li>
   <li>This is the second list item</li>
   <li>This is the third list item</li>
   <li>This is the fourth list item</li>
   <li>This is the fifth list item</li>
   <li>This is the sixth list item</li>
 </ol>

 

On a WMS page, it would display a numbered list:

Numbered List

If the grid class is applied to the ol tag:

 

<ol class="grid">
   <li>This is the first list item</li>
   <li>This is the second list item</li>
   <li>This is the third list item</li>
   <li>This is the fourth list item</li>
   <li>This is the fifth list item</li>
   <li>This is the sixth list item</li>
 </ol>

 

It will transform the list into a numbered grid display:

Numbered grid

The same can be done with unordered lists:

 

<ul class="grid">
   <li>This is the first list item</li>
   <li>This is the second list item</li>
   <li>This is the third list item</li>
   <li>This is the fourth list item</li>
   <li>This is the fifth list item</li>
   <li>This is the sixth list item</li>
 </ul>

 

Which would yield a basic grid without numbers.

Unordered list

Additional Classes

Below is a list of classes that can be used in combination with the grid class:

ClassPurposeList typeHTMLExample
zeroremoves bordersol, ul<ul class="grid zero">Sectional navigation
alternateadds a grey backgroundol, ul<ul class="grid alternate">A series of steps in a process
enhancechanges the colour of the list numberol<ol class="grid enhance">Nested lists
info

Note:

The classes zero, alternate and enhance can be combined for additional configurations, e.g.:

  • <ol class="grid zero enhance">
  • <ol class="grid alternate enhance">


Use cases

The following examples demonstrate how grid displays can be used, including a short description and some code snippets:

A series of steps in a process

Grid display

This example was created using:

 

HTML code snippet
<ol class="grid alternate">
<li>Ask a colleague or professor to review your research paper.</li>

 

A gallery of images

Gallery

This example was created using:

 

HTML code snippet
<ul class="grid">
    <li>
        <p style="text-align: center;"><strong>Canada Goose</strong><br><br>
                [[{"fid":"128103","view_mode":"default","fields":{"format":"default","field_tags[und]":"","field_display_style[und][0][value]":"_none","media_description[en][0][value]":"","field_file_image_alt_text[en][0][value]":"","field_file_image_title_text[en][0][value]":"","field_credit[en][0][value]":"","media_title[en][0][value]":"","field_license[und]":"none"},"type":"media","attributes":{"height":169,"width":160,"class":"media-element file-default"}}]]</p>
    </li>

 

Content previews

Previews

This example was created using:

 

HTML code snippet
<ul class="grid">
        <li>

        <p> [[{"fid":"128133","view_mode":"default ","fields":{"format":"default
","field_tags[und]":"","field_display_style[und][0][value]":"_none",
"media_description[en][0][value]":"","field_file_image_alt_text[en][0][value]":"",
"field_file_image_title_text[en][0][value]":"","field_credit[en][0][value]":"",
"media_title[en][0][value]":"","field_license[und]":"none"},"type":"media",
"attributes":{"height":104,"width":160,"class":"media-element file-default"}}]]<br>
    <small>The Beyond Me network brings together special needs children with McGill student mentors... <strong>https://mcgill.ca/somelinkmcgillimpact</strong>. <a href="https://mcgill.ca/somelink">Learn more</a></small></p>
        </li>

 

Sectional navigation

example of sectional division using different areas of study

This example was created using:

 

HTML code snippet
<ul class="grid zero">
      <li>
            <p style="text-align: center;"><a href="https://mcgill.ca/somelink">[[{"fid":"128118","view_mode":"default","fields":
{"format":"default","field_tags[und]":"","field_display_style[und][0][value]":"_none","media_description[en][0][value]":"",
"field_file_image_alt_text[en][0][value]":"","field_file_image_title_text[en][0][value]":"","field_credit[en][0][value]":"",
"media_title[en][0][value]":"","field_license[und]":"none"},"type":"media","attributes":{"height":100,"width":100,"class": "media-element file-default"}}]]</a></p>
            <h4 style="text-align: center;"><a href="https://mcgill.ca/somelink">Accounting and Finance</a></h4>
      </li>

 


Grid appearance

Responsive display

Grid displays are responsive, and the size and placement of squares will adapt to certain elements:

Device screen (viewport) or browser window

If a grid is viewed on a smaller device or narrow browser window with a width of 600 pixels or less, the display will change to stacked panels.

Below is an example of how a previous example showing a series of steps in a process would be displayed on a tablet:

Tablet

The presence of sidebars and/or vertical menus

Three columns will be displayed if:

Two columns will be displayed if:

Content in list items

List items (which appear as squares) will have the same height across the same row. This means that the height of the square with the longest or most content will be inherited by all the other squares in that row.


Best practices and tips

Use with three or more list items

Use the grid class if there are three or more items in your list, otherwise just use column templates. There can be an exception for lists with two list items that appear on pages with a vertical menu AND a sidebar with blocks.

 

Use Source view in the WYSIWYG editor

The WYSIWYG editor can be used to create the initial list, as well as for minor formatting tasks such as alignment, or bolding, or italicizing text. However, once the grid class is applied, it is advisable to edit the HTML source.

 

Nested lists

Just as with normal lists, list items in a grid can contain nested lists.

<ol class="grid enhance">
    <li>Download a copy of the request form <a href="https://mcgill.ca/somelink">here</a>.</li>
    <li>Inform your direct supervisor that you intend to make a request.</li> 
    <li>Prepare the following requirements: 
         <ol> 
                 <li>McGill ID</li> 
                 <li>Record of Employment</li> 
                 <li>Completed request form</li> 
                 <li>Letter of support from supervisor</li> 
         </ol> 
    </li> 
    <li>Schedule an appointment to deliver your request along with the requirements.</li> 
</ol>

The code above will yield the following grid:

Nested

 

Grids cannot be placed inside list items or sidebar blocks

While lists can be nested within list items, if the grid class were applied, the list would not be displayed.

Similarly, while lists can be placed in sidebar blocks, they would not be displayed if the grid class were applied.

 

Enter/Return key

Pressing the Enter or Return key when the cursor is inside a list item will create a new list item.

 

Backspace/Delete key

Pressing the Backspace or Delete key when the cursor is inside a list item will delete that list item.


references

ADDITIONAL REFERENCES: