Custom CSS is one of the fastest ways to customize your MindTouch site. Now with the inclusion of LESS, custom CSS has gotten even easier.
Why use CSS?
To follow best practice coding standards, separate the styling from your structural content as much as possible. To enable content managers to apply site-side styles without having to place code onto every page, MindTouch offers a custom CSS section in the control panel.
How to place site-wide CSS code
- From the MindTouch toolbar, select Site tools > Control panel.
- In the Branding section, click the Custom Site CSS link.
- Place your code in one of the appropriate CSS sections.
- Click Save.
Custom header and footer templates will not load in mobile sized views and adding custom CSS to them will not render either.
Add custom CSS by user role
There are six different CSS sections that conditionally load CSS based on the user who is viewing the page. Click the links below to learn how you can leverage the various sections to display CSS to only certain users.
- ► All Roles CSS
- Overrides the CSS for all user types. CSS or LESS entered into the All Roles CSS section display to every user no matter the type.
- ► Anonymous CSS
- Overrides the CSS for users that aren't logged in to MindTouch Responsive and are anonymously navigating the site.
- ► Community Member CSS
- Overrides the CSS for users that are logged in as community members.
- ► Pro Member CSS
- Overrides the CSS for users that are logged in as pro members. CSS entered into the Pro Member CSS section will display to all pro members except admins.
- ► Admin CSS
- Overrides the CSS for users that are logged in as admins. Only admins can see this CSS entered in this section (does not include Pro Member CSS!)
- ► Legacy Browser CSS
- Enables your site to be branded for legacy browsers.
Place code in the Admin CSS section to verify the effects of your code and test style changes before placing them in to the All Roles CSS section. This allows pro members to test the code without affecting the the rest of the viewing community.
LESS is a CSS pre-processing language that extends the default functionality found in CSS. The LESS syntax is identical to CSS which means that regular CSS will work as before. Because LESS files are processed before being served to a web browser as valid CSS, additional functionality can be used in the CSS code such as variables, mixins, ruleset nesting and functions.
An example of how easy it is to update the look of your site with LESS is by changing the
@higlight-color variable. By adding the following LESS variable to the custom CSS section of your choice, you can change the base color of your site from blue to orange.
Check out our documentation on branding with LESS to learn about all the new ways you can customize your CSS.
CSS and LESS validation on Save
To avoid compilation errors with the LESS pre-processor, all CSS/LESS code submitted in the control panel is validated before being saved. This means that you will never have to worry about invalid CSS or LESS disabling the styles applied to your site.
For additional information about optimizing the performance of your custom CSS, read our best practice on custom CSS overrides.