Design
We use a compound relative grid, which is usually six columns but can be combined with four columns. Note the centre gutter aligns here:
1-6
1-6
1-6
1-6
1-6
1-6
1-4
1-4
1-4
1-4
Code
To keep the code simple, the 4 and 6 column grid is supported by a 12-column implementation. Classes are named as a number out of 12: ace-item-(cols)
. It is important to understand that we do not use a 12 column grid design, this is just a translation between design and code!
The grid layout is invoked by setting the group element to gutters-on and specifying widths on all items. This is an all-or-none pattern: specify all desired grid layout sizes, or none. When no sizes are specified, the non-grid layout still applies and simply divides available space evenly. At small screen sizes, the layout linearises as usual.
Because this is a relative grid based on percentage widths, nesting the grid does not work. Set up your grid one time and work within it. If you nest grids they won't line up to the grid lines. Non-sized layouts like fit and fill will work when nested, as they are relative to content and not the overall viewport.
Use caution with tables and images
If you need responsive tables, set the containing item to 'fill'. With all other settings, large tables will push out of their containers when they can no longer wrap. This is not a bug, this is an inherent behaviour of tables - when they don't fit, they don't fit!
Similarly large, unconstrained images will break out when they don't fit. The best solution is to apply the helper class ace-fit
to the img
element; or set images to max-width:100%
in your styles.
Example | Code |
---|---|
Set group to gutters on. 3-6 3-6 |
Gutters on:
This feature was added to ACE after ACE Classic Templates went into maintenance mode (bugfixes only). By default new ACE features are not supported in Classic, but can be contributed if a specific need is identified. |
Specify column widths as a number out of 12. To calculate the four-column grid, multiply by 3; for the six column grid, multiply by 2. So a 1/4 column is 3, and a 1/6 column is 2. 1-6 5-6 1-4 3-4 |
This feature was added to ACE after ACE Classic Templates went into maintenance mode (bugfixes only). By default new ACE features are not supported in Classic, but can be contributed if a specific need is identified. |
Items can be offset with the same naming pattern as widths ( Size 10, Offset 2 Size 8, Offset 2 Size 9, Offset 3 Size 3, Offset 3 Size 2, Offset 2 Size 6, Offset 3 |
This feature was added to ACE after ACE Classic Templates went into maintenance mode (bugfixes only). By default new ACE features are not supported in Classic, but can be contributed if a specific need is identified. |
The fit item disables wrapping (be careful!) and fits item to the boundaries of the content; while fill items simply expand to fill the remaining space. Fill is the default behaviour but it is recommended you declare that behaviour explicitly. Note that if you need uniform-width items in IE11, you must use explicit sizes and not rely on fit/fill with uniform-sized content (eg. images with the same dimensions). Despite uniform content, in some cases IE11 does not calculate and apply uniform widths. Fit content. Fill the rest of the available space. |
This feature was added to ACE after ACE Classic Templates went into maintenance mode (bugfixes only). By default new ACE features are not supported in Classic, but can be contributed if a specific need is identified. |
The horizontal alignment modifiers are Left. Centre. Right. |
This feature was added to ACE after ACE Classic Templates went into maintenance mode (bugfixes only). By default new ACE features are not supported in Classic, but can be contributed if a specific need is identified. |
The vertical alignment modifiers are Top. Middle. Bottom. Some long content to push this around enough to see the alignment. Some long content to push this around enough to see the alignment. Some long content to push this around enough to see the alignment. Some long content to push this around enough to see the alignment. Align baseline. Align baseline.Align baseline. |
This feature was added to ACE after ACE Classic Templates went into maintenance mode (bugfixes only). By default new ACE features are not supported in Classic, but can be contributed if a specific need is identified. |