Math equation grid - documentation
Purpose
To create a way to layout simple math equations or calculations.
Usage
Use to
- Align math equations or calculation patterns
- Replicate calculation layouts from a document (e.g. PDF) in HTML
Do not use to
- Create a layout for general content
- Refer to: Grid system - WET4
- Use the grid system when needing to create specific column widths
- In place of a table when the content should be in that format
- Refer to: Tables - WET4
- Stylize complex math equations
- Refer to: MathML - WET4
Working examples
Evaluation and report
Not yet evaluated
Accessibility guidance
Use HTML entity names or codes for math symbols in order display without CSS or additional accessibility support.
Style HTML symbols instead of using icons, unless you have a fall back in case the icon style sheet does not load. Icons also need invisible text for screen reader devices.
Character | Description | HTML entity | HTML code |
---|---|---|---|
+ | Plus sign | + or + | + |
− | Minus sign | − | − |
× | Multiplication sign | × | × |
÷ | Division sign | ÷ | ÷ |
= | Equal sign | = or = | = |
% | Percent sign | % or % | % |
How to implement
- Create a parent element
<div class="wb-math-grid">
- Create a row for each line item and calculation
<div class="mg-row">
- Create the same number of cells needed to display each line item fully
Using
<div>
on cell
Use <div> elements, as inline elements may cause unexpected issues<div class="wb-math-grid">
<div class="mg-row">
<div class="mg-cell"></div>
...
</div>
</div> - Repeat for the amount of rows needed for the equation
Use an equal number of cells for all rows of the equation, even when there is no content. If the aligned cell does not have information, leave it blank.
Configuration options
Class options
Class | Description | How to configure |
---|---|---|
mg-spcd |
Adds 10px (5px top/5px bottom) of spacing to all or specific rows |
|
mg-brdr-otln |
Adds a stronger border line around the entire cell | <div class="mg-cell mg-brdr-otln"> |
mg-brdr-tp |
Adds a stronger border line along the top of a row or specific cell |
|
mg-brdr-bttm |
Adds a stronger border line along the bottom of a row or specific cell |
|
mg-brdr-lft |
Adds a stronger border line on the left of a specific cell | <div class="mg-cell mg-brdr-lft"> |
mg-brdr-rght |
Adds a stronger border line on the right of a specific cell | <div class="mg-cell mg-brdr-rght"> |
mg-scroll |
Adds a scroll to equations who's rows are set with no wrapping (to preserve inheritance from original design) | <div class="mg-scroll"> |
You can also use many existing GCWeb styling for this component.
Attribute options
Option | Description | How to configure | Values |
---|---|---|---|
srPause |
Will require screen readers to navigate the equation more precisely. | data-wb-math-grid='{"pause": true}' |
|
Source code
Page details
- Date modified: