What are CSS Helper Classes
CSS Helper Classes are CSS Classes that are defined in X/Pro readily available to use in any element on your site that will speed up your development time by utilising them in your daily workflow.
Body Classes are used throughout our theme and give you an easy way to target certain other classes or whole sections with the use of CSS.
One of the best things you can do to get a good overview of the classes and associated stylings is take advantage of the Inspect Element feature in Chrome. To do so, simply right-click on any part of your page that you want to take a look at and select Inspect Element from the dropdown that appears. Once you do that, a popup should appear at the bottom of your browser with markup (HTML) on the left and styling (CSS) on the right. You can then browse the markup of your site, select certain elements, and see what styling is applied to these elements via their selectors. This is a great tool to take advantage of if you have any questions about how an element is styled and what you can do to alter it.
The classes listed in this section are not meant to be targeted with CSS to alter their styling or functionality. Instead, these classes already perform a specified action and are meant to be used with various elements when needed.
In order for pages to be structured properly, all elements must receive some type of margin or padding for adequate spacing. While this spacing is beneficial in most cases, it might be something you wish to remove or modify at other times. We have provided plenty of helper classes to use in these instances. These helper classes allow you to modify the margin and padding of elements by removing the spacing completely, or adding a small, medium, or large amount of spacing. These classes are an acronym built from three different parameters:
- Margin (m) or padding (p).
- Top (t), left (l), right (r), bottom (b), vertical (v), horizontal (h), or all (a).
- None (n), small (s), medium (m), or large (l).
For example, if you wanted to add a class that removes all of the margin from the top of an element you would use
mtn, which stands for margin top none. Alternately, if you wanted to add a small amount of padding to both sides of an element you would use
phm, which stands for padding horizontal medium.
To figure out where the spacing on an element is coming from, you can easily do this in Chrome. Simply right click on any element and select Inspect Element from the dropdown. This will reveal a popup at the bottom of your window, which will display HTML on the left and CSS on the right. You can hover over the HTML in the popup and select elements to see where any margin or padding is coming from. Margin is designated by a reddish/orange color and padding is designated by green.
You now have a extensive overview of CSS Helper Classes and how to use them to increase your productivity.
See something inaccurate? Let us know