Ascension 1.0 - Template Documentation

Grid

The grid is an essential component for creating layouts. Ascension employs a flexbox-based grid that's super easy to use and customize.

Basic grid usage

You can define a grid by using the .grid class. Then, inside that container you must define any number of cells, using the .cell class.

The example below shows a simple grid with 2 cells.

Code Preview
						                            
						                                <div class="grid">
						                                    <div class="cell">
						                                        This is the cell content
						                                    </div> <!-- end .cell -->
						                                    <div class="cell">
						                                        This is the cell content
						                                    </div> <!-- end .cell -->
						                                </div> <!-- end .grid -->
						                            
						                        
This is the cell content
This is the cell content

Block grid

There is the option so setup a block grid by using the .block class on a grid element. This will ensure all subsequent cells have the same height and have the same distance in between.

Code Preview
						                            
						                                <div class="grid block gutter md-12 lg-6 xlg-4 text-center">
						                                    <div class="cell">
						                                        <div class="card with-border">
						                                            The card content.
						                                        </div> <!-- end .card -->
						                                    </div> <!-- end .cell -->
						                                    <div class="cell">
						                                        <div class="card with-border">
						                                            The card content.
						                                        </div> <!-- end .card -->
						                                    </div> <!-- end .cell -->
						                                    <div class="cell">
						                                        <div class="card with-border">
						                                            The card content.
						                                        </div> <!-- end .card -->
						                                    </div> <!-- end .cell -->
						                                    <div class="cell">
						                                        <div class="card with-border">
						                                            The card content.
						                                        </div> <!-- end .card -->
						                                    </div> <!-- end .cell -->
						                                    <div class="cell">
						                                        <div class="card with-border">
						                                            The card content.
						                                        </div> <!-- end .card -->
						                                    </div> <!-- end .cell -->
						                                    <div class="cell">
						                                        <div class="card with-border">
						                                            The card content.
						                                        </div> <!-- end .card -->
						                                    </div> <!-- end .cell -->
						                                </div> <!-- end .grid -->
						                            
						                        
The card content.
The card content.
The card content.
The card content.
The card content.
The card content.

Cell sizing

By default, a .cell will occupy all the available space. If there is more than 1 cell, then those cells will divide the available space equally (see the example above). However, you can specify a cell size by giving it a number from 1 to 12 (by default). This will occupy as many columns as you specify in a 12-column grid. For example, if you wish to create a cell that's half the size of the available space, you would give it the number 6.

The size classes are applied in conjunction with the breakpoints. That means you can have individual sizes for different breakpoints. Take a look at the example below:

Code Preview
						                            
						                                <div class="grid">
						                                    <div class="cell md-10 lg-6 xlg-4">
						                                        The first cell.
						                                    </div> <!-- end .cell -->
						                                    <div class="cell md-2 lg-6 xlg-8">
						                                        The second cell.
						                                    </div> <!-- end .cell -->
						                                </div> <!-- end .grid -->
						                            
						                        
The first cell.
The second cell.

The two cells have different sizes based on different breakpoints. In this case, on screens of medium size and above the first cell has a width of 10 columns, while the second one has a width of 2 columns. On large screens they are equal in size, while on extra-large screens the first occupies 4 columns while the second one 8. You can very easily see these changes by resizing your browser window and measuring the column sizes.

The sizes depend on the available breakpoints. Here are the default ones, as found in _settings.scss:

						                
						                    $breakpoints: (
						                        'sm': 0,
						                        'md': 768px,
						                        'lg': 1280px,
						                        'xlg': 1920px    
						                    );
						                
						            

The key represents the id of the breakpoint which can be used to declare the sizing classes while the value represents the minimum width of the breakpoint. In our case, for example, the large breakpoint is triggered when the screen width exceeds 1280px.

Global cell sizing

The approach you saw above assigns individual sizing classes to each cell, but there are cases when all cells are of equal size so it doesn't make sense to apply the same classes to all cells. In this case you can apply the sizing classes to the parent .grid element, like so:

Code Preview
						                            
						                                <div class="grid md-6 lg-4">
						                                    <div class="cell">
						                                        This is the cell content.
						                                    </div> <!-- end .cell -->
						                                    <div class="cell">
						                                        This is the cell content.
						                                    </div> <!-- end .cell -->
						                                </div> <!-- end .grid -->
						                            
						                        
This is the cell content.
This is the cell content.

In this example, both cells have the widths of .md-6 and .lg-4.

Cell shrinking

The .shrink allows a cell to only stretch as far as it's required by the content.

Code Preview
						                            
						                                <div class="grid">
						                                    <div class="cell shrink">
						                                        This is a shrunken cell.
						                                    </div> <!-- end .cell -->
						                                    <div class="cell">
						                                        This is a regular cell.
						                                    </div> <!-- end .cell -->
						                                </div> <!-- end .grid -->
						                            
						                        
This is a shrunken cell.
This is a regular cell.

Gutters

By default, the grid doesn't have a gutter or distance between cells. These are flush with one another. Adding gutters can be done by using the class of .gutter to the grid. The following two examples show a grid without gutters and one with gutters applied.

Code Preview
						                            
						                                <div class="grid sm-6">
						                                    <div class="cell">
						                                        This is the cell content.
						                                    </div> <!-- end .cell -->
						                                    <div class="cell">
						                                        This is the cell content.
						                                    </div> <!-- end .cell -->
						                                </div> <!-- end .grid -->
						                            
						                        
This is the cell content.
This is the cell content.
						                            
						                                <div class="grid gutter sm-6">
						                                    <div class="cell">
						                                        This is the cell content.
						                                    </div> <!-- end .cell -->
						                                    <div class="cell">
						                                        This is the cell content.
						                                    </div> <!-- end .cell -->
						                                </div> <!-- end .grid -->
						                            
						                        
This is the cell content.
This is the cell content.