Joomla offers us the ability to use CSS styles to change the style of groups of modules with module classes. In fact, module classes are the main way that professional template designers control the appearance of modules in their templates. They create beautiful module classes and then have their customers type in these module class names to give their modules a distinctive appearance. In this article, we will create our own custom module class and then apply it to one or more of our custom modules.
Apply a simple background color class to a custom module
We have already seen how classes can be used to change the background color of a menu item. Recall that we placed classes such as .lightblue {background-color: #eeeeff; font-weight: bold;} in the Helix Template Custom CSS file. Then for any menu item we wanted to have a light blue background, we simply typed in lightblue (without the leading dot) in the menu item Link Class box.
We can use this style on as many menu items as we want and on as many menus as we want. Here is what this light blue class looks like on the front end Main Menu:
The reason the bold part does not appear is because our custom.css is being over-ridden by the Helix Typography Internal CSS. Right click on the Page Source to see this:
<style>.sp-megamenu-parent > li > a, .sp-megamenu-parent > li > span, .sp-megamenu-parent .sp-dropdown li.sp-menu-item > a{font-family: 'Arimo', sans-serif; font-size: 18px; font-weight: 400; text-decoration: none;}</style>
To allow us to control the appearance of individual menu items, we should first go to Templates, Styles, Helix, Typography and turn off the Helix Navigation typography. Unfortunately, this makes our font size for all of our menu items very small: