CSS Classes & Mixins

ignition comes with some helpful classes you can use or completely ignore. They are very useful and can save you time while creating your websites.

For the grid and layout classes see these articles.

Below are the classes added to ignition that you can use. Most are self explanatory.

Typography Classes


/*------- Text Classes. Found in Typography.scss --------*/ 
.text-center {
   text-align: center;
}

.text-right {
   text-align: right;
}

.text-left {
   text-align: left;
}

.text-justify{
   text-align: justify;
}

//only center the headings found inside an element
.heading-center {
   h1, h2, h3, h4, h5, h6 {
      text-align: center;
      }
}

Display Classes

These classes can hide content. The screen-reader-text is very useful. It can hide content on a screen but a screen reader will still read the content. It can also be useful is circumstances where you want to hide something but still need it on the page.

The clear fix is included but not really needed anymore as floats are not being used to make columns. Thew clear fix fixed display issues on collapsed elements.

/*------- Display Classes --------*/ 

.hidden, .hide {
  display: none;
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important; 
}

.clear:before,
.clear:after {
  content: "";
  display: table;
  table-layout: fixed;
}

.clear:after {
  clear: both;
}

Image classes

.background-image {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  display: block;

  img {
    object-fit: cover;
    height: 100%;
    width: 100%;
    position: relative;
  }

}

.cover-image {
  width: 100%;
  display: block;

  img {
    object-fit: cover;
    left: 0;
    right: 0;
    height: 100%;
    width: 100%;
  }
}

.background-image

This class will allow you to make a foreground image element fill a div like a background image set to cover. Here is the css found in media.scss

To use it just add a div.background-image inside an element. Make sure the element has a position of relative or the whole page will get covered! You may also need to add a height to the element.
Check it out below.

<div class="some-element layout-center-content" style="position: relative; height: 200px;">
  <div class="background-image">
    <img src="https://placekitten.com/g/500/300" />
 </div>
 <p style="color: white;">Hello World!</p>
</div>

Above I set the parent element to have a set height as well as positioned it relative. I added text on top set to white. I also used the class layout-center-content to center my content. You can learn more about that in the layout section.

IE has been set to automatically turn the image into a background image on the parent div so it will work in IE too!

.cover-image

Will add an image set to cover, but unlike background=image it will not be absolute and text cannot be on top.

<div class="some-element" style="position: relative;">
  <div class="cover-image">
    <img src="https://placekitten.com/g/200/300" />
 </div>
 <p>Hello World!</p>
</div>

Font-size Mixin

For font sizes, ignition has a font size variable. If you make this variable bigger or smaller, the font sizes across the entire site will grow or shrink. Ignition has a mixin that makes it easy to quickly add a font size that uses the css variable, and it is based on rem. Make sure you use the variable when adding your font sizes so that they can be dynamically changed. A mixin has been added to make this very easy for you.

@mixin font-size($sizeValue: 16) {
  @if($sizeValue == 16){
    font-size: var(--font-size);
  }
  @else if ($sizeValue < 16) {
    $size: 16px - $sizeValue;
    font-size: calc(var(--font-size) - #{$size});
  } @else {
    $size: $sizeValue - 16px;
    font-size: calc(var(--font-size) + #{$size});
  }
}

.element{
  @include font-size(20); //would make a 20px font size. 
  //If the --font-size variable is made larger this will grow proportionally.
}

You can read more about the font-size on the css variable page.